Java Byte Array to BufferedImage byteArrayToBufferedImage(byte[] array)

Here you can find the source of byteArrayToBufferedImage(byte[] array)

Description

Convert byte array to BufferedImage

License

LGPL

Parameter

Parameter Description
array a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static BufferedImage byteArrayToBufferedImage(byte[] array) throws IOException 

Method Source Code


//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;
    }
}

Related

  1. byteArrayToBufferedImage(byte[] image)
  2. byteArrayToImage(byte[] imagebytes)
  3. byteArrayToImage(byte[] imageData)
  4. bytesToBufferedImage(final byte[] imageData)