开发者

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

开发者 https://www.devze.com 2023-02-10 03:55 出处:网络
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,

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开发者_Go百科 = 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消