Java BufferedImage to Byte Array imageToByte(BufferedImage bi, String format)

Here you can find the source of imageToByte(BufferedImage bi, String format)

Description

image To Byte

License

Open Source License

Declaration

public static byte[] imageToByte(BufferedImage bi, String format) throws IOException 

Method Source Code

//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[] imageToByte(BufferedImage bi, String format) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(bi, format, baos);
        return baos.toByteArray();
    }//  ww  w.  ja v a 2s . c o m
}

Related

  1. getBytesFromBufferedImage(BufferedImage bi, String format)
  2. getBytesFromImage(String fileIn, String fileOut)
  3. getBytesPerPixel(int bufferedImageType)
  4. image2Bytes(BufferedImage image)
  5. image2Bytes(File f)
  6. imageToByte(BufferedImage image)
  7. imageToByte(BufferedImage img)
  8. imageToByteArray(BufferedImage o)
  9. imageToBytes(BufferedImage image, String encoding)