Thursday, March 19, 2009

How do I read an image from a byte array in Java?

Create a ByteArrayInputStream from your byte array and then use ImageIO class to read image from that stream.

InputStream in = new ByteArrayInputStream(bytearray);
BufferedImage image = ImageIO.read(in);

No comments: