Java BufferedImage Load loadImageFromBytes(byte[] bytes)

Here you can find the source of loadImageFromBytes(byte[] bytes)

Description

load Image From Bytes

License

Open Source License

Declaration

public static Image loadImageFromBytes(byte[] bytes) 

Method Source Code


//package com.java2s;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;

import java.io.IOException;

import javax.imageio.ImageIO;

public class Main {
    public static Image loadImageFromBytes(byte[] bytes) {
        try {/*  www  .j a  v a 2 s  . com*/
            ByteArrayInputStream is = new ByteArrayInputStream(bytes);
            BufferedImage image = ImageIO.read(is);
            is.close();
            return image;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. loadImage(String url)
  2. loadImage(URL resource)
  3. loadImage(URL url)
  4. loadImageData(BufferedImage image)
  5. loadImageData(String name)
  6. loadImageFromFile(File f)
  7. loadImageFromFile(File file)
  8. loadImageFromFile(String filename)
  9. loadImageFromFile(String fileName)