[英]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. 我有
java.awt.Image
对象,我想将其转换为包含每个像素RGB值的bytes数组。 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()
. 检查
java.awt.image.BufferedImage.getRGB()
的重载或java.awt.image.Raster
的方法,这些方法可以通过BufferredImage.getRaster()
获得。 You can find some sample usage here . 您可以在此处找到一些示例用法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.