title: How/Can I use base64 as image source in a Jasper Report template?
body: <p>So in my jrxml file I have the following:</p>
  
  <pre><code>&lt;parameter name="smileyfaceimage" class="java.lang.String"/&gt;
  </code></pre>
  
  <p>Then I reference it in:</p>
  
  <pre><code>&lt;image scaleImage="FillFrame" onErrorType="Blank"&gt;
      &lt;reportElement x="167" y="62" width="363" height="171" backcolor="#333333"/&gt;
      &lt;imageExpression class="java.lang.String"&gt;&lt;![CDATA[$P{smileyfaceimage}]]&gt;&lt;/imageExpression&gt;
  &lt;/image&gt;
  </code></pre>
  
  <p>Is this not correct? </p>
  
  <p>I've tried the base64 both with and without:</p>
  
  <pre><code>data:image/png;base64,
  </code></pre>
  
  <p>Here's the image im working with </p>
  
  <p><a href="https://i.stack.imgur.com/aNjwG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aNjwG.png" alt="just a random screenshot"></a></p>
  
  <p>Then I used <a href="https://www.base64-image.de/" rel="noreferrer">https://www.base64-image.de/</a> or any random site to get the base64 string. I tested the string it produces and it's valid.</p>
  
  <p>Now in my code;</p>
  
  <ul>
  <li>set the value of a variable to the based64 string</li>
  <li>on the template 
  
  <ul>
  <li>set the parameter: <code>&lt;parameter name="smileyfaceimage" class="java.lang.String"/&gt;</code></li>
  </ul></li>
  <li><p>then add the image data to the page:</p>
  
  <ul>
  <li><pre><code>&lt;image scaleImage="FillFrame" onErrorType="Blank"&gt;
      &lt;reportElement x="167" y="62" width="363" height="171" backcolor="#333333"/&gt;
      &lt;imageExpression&gt;&lt;![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($P{smileyfaceimage}.getBytes()))]]&gt;&lt;/imageExpression&gt;
  &lt;/image&gt;
  </code></pre></li>
  </ul></li>
  </ul>
  
  <p>Am I missing a step?</p>