title: Saving Base64 String as .PNG not working
body: <p>I have a base64 string that I got from using Google Charts.
  The project is being written in Python/Django/Javascript if that helps.</p>
  
  <pre><code>chartStr = chart.getImageURI()
  </code></pre>
  
  <p>I want to save this string as a .png on my server.</p>
  
  <p>I've tried</p>
  
  <pre><code>with open('foo.png',"wb") as f:
      f.write(chartStr.decode('base64'))
  </code></pre>
  
  <p>but I get an incorrect padding error. I fix this by adding a '=' at the end of the string chartStr. WHen I do that, the foo.png image is created but when I try to open it I get an error that says </p>
  
  <p><b>Fatal error reading PNG image file: Not a PNG file</b></p>
  
  <p>Any advice?
  Thanks!</p>