Here you can find the source of byteArrayToBufferedImage(byte[] array)
Parameter | Description |
---|---|
array | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static BufferedImage byteArrayToBufferedImage(byte[] array) throws IOException
//package com.java2s; //License from project: LGPL import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; public class Main { /**/*from w w w .ja v a2 s . com*/ * Convert byte array to {@link BufferedImage} * * @param array * @return * @throws IOException */ public static BufferedImage byteArrayToBufferedImage(byte[] array) throws IOException { InputStream in = new ByteArrayInputStream(array); BufferedImage bImageFromConvert = ImageIO.read(in); return bImageFromConvert; } }