title: In Java is it possible to convert a BufferedImage to an IMG Data URI?
body: <p>I have created a graphical image with the following sample code. </p>
  
  <pre><code>BufferedImage bi = new BufferedImage(50,50,BufferedImage.TYPE_BYTE_BINARY);
  Graphics2D g2d = bi.createGraphics();
  
  // Draw graphics. 
  
  g2d.dispose();
  // BufferedImage now has my image I want.
  </code></pre>
  
  <p>At this point I have BufferedImage which I want to convert into an IMG Data URI. Is this possible? For example.. </p>
  
  <pre><code>&lt;IMG SRC="data:image/png;base64,[BufferedImage data here]"/&gt;
  </code></pre>