Java examples for 2D Graphics:BufferedImage Convert
Converts a byte Array to an BufferedImage
//package com.java2s; 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. c o m*/ * Converts a byte Array to an {@link BufferedImage} * * @param imgBytes * @return * @throws IOException */ public static BufferedImage byteArrayToImage(byte[] imgBytes) throws IOException { BufferedImage bufferedImage = null; InputStream inputStream = new ByteArrayInputStream(imgBytes); bufferedImage = ImageIO.read(inputStream); return bufferedImage; } }