title: PIL Clipboard Image to Base64 string
body: <p>I want to get the image in the clipboard and convert its data into a base64 encoded string so that I can put that into a HTML img tag.</p>
  
  <p>I've tried the following:</p>
  
  <pre><code>from PIL import ImageGrab
  from base64 import encodestring
  img = ImageGrab.grabclipboard()
  imgStr = encodestring(img.fp.read())
  </code></pre>
  
  <p>Plus some other combinations, all of which give me incorrect representations of the image. </p>
  
  <p>I'm struggling with the docs on this one; does anyone have an idea on how to accomplish this?</p>