Java examples for 2D Graphics:Image Load
get Image As Bytes
//package com.java2s; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.imageio.ImageIO; public class Main { public static byte[] getImageAsBytes(BufferedImage imgimage, String encoding) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(imgimage, "jpeg", out); return out.toByteArray(); }/* w ww. j a v a 2 s. com*/ }