Here you can find the source of bytesToImage(byte[] imageData)
Parameter | Description |
---|---|
imageData | The byte array of the data to convert. |
Parameter | Description |
---|
static public BufferedImage bytesToImage(byte[] imageData) throws IOException
//package com.java2s; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.imageio.ImageIO; public class Main { /**/*from www. j a va 2 s . co m*/ * Converts a byte array into an image. The byte array must include the * image header, so that a decision about format can be made. * * @param imageData The byte array of the data to convert. * @return Image The image instance created from the byte array * @throws java.io.IOException if any. * @see java.awt.Toolkit#createImage(byte[] imagedata) */ static public BufferedImage bytesToImage(byte[] imageData) throws IOException { return ImageIO.read(new ByteArrayInputStream(imageData)); } }