Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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]">
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #outputstream #image #js
ADD COMMENT
Topic
Name
3+9 =