简体   繁体   中英

How to convert java.awt.Image to byte arrays in java?

I have the java.awt.Image object and I want to convert it into bytes array that contain RGB value of each pixel. For example,

byte[][][] image_color = new byte[3][image.getWidth()][image.getHeight()];

Big Thanks

Check the overloads of java.awt.image.BufferedImage.getRGB() , or the methods of java.awt.image.Raster , which can be obtained through BufferredImage.getRaster() . You can find some sample usage here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM