convert png to byte array for html code example
Example 1: outputstream to image js example
<img src="data:image/png;base64,[ENCODED STRING GOES HERE]">
Example 2: outputstream to image js example
// Java side
BufferedImage image = ImageIO.read(new File("helloworld.png"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", outputStream);
String encodedImage = Base64.encode(outputStream.toByteArray());
// js side
<img src="data:image/png;base64,[ENCODED STRING GOES HERE]">