Byte Array to Image object

Señor Reginold Francis picture Señor Reginold Francis · Oct 16, 2009 · Viewed 115.1k times · Source

I am given a byte[] array in Java which contains the bytes for an image, and I need to output it into an image. How would I go about doing this?

Much thanks

Answer

Nick Veys picture Nick Veys · Oct 16, 2009
BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));