Convert byte array (byte[]) to Image in Java
I have a byte[] that I want to convert to an Image and display the image in a label. The byte[] is of a jpeg 2000 format. I have tried the code below but it returns null: InputStream in = new ByteArrayInputStream(bytearray); BufferedImage image = ImageIO.read(in); The image value comes back as null . I want to be able to display the image in a label like below: jLabel.setIcon(new ImageIcon(image)); Thanks To convert an array of bytes, i.e. byte[] into an Image , use getImage() . Probably the easiest way to do this is to instantiate an ImageIcon using the ImageIcon(byte[]) constructor, and then