title: Python 3 image base64 without saving into html img tag
body: <p>I would like to create an image (without save it to the disk), and show it in a browser. As I know I have to create a base64 image, but I don't know how I can make it.</p>
  
  <p>Can you help me?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>from PIL import Image, ImageDraw
  import base64
  
  im = Image.new('RGBA', (200, 100),  color = 'black')
  data_uri = #missing how I can convert the image to base64 ?
  
  html = '&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;'
  html += '&lt;img src="data:image/png;base64,{0}"&gt;'.format(data_uri)
  html += '&lt;/body&gt;&lt;/html&gt;'
  
  print (html)
  </code></pre>