outputStream a imagen JS Ejemplo
// 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]">
Cheerful Cassowary