Monochrome grayscale image, get the intensity of a pixel

蹲街弑〆低调 提交于 2019-12-02 05:20:11

Maybe this will help you:

http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html

http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html

BufferedImage img = ImageIO.read(new File("filePath.png"));

int sRbgColor = img.getRGB(int x, int y);

Color c = new Color(sRbgColor);
int red = c.getRed();
int green = c.getGreen();
int blue = c.getBlue();

If it's monochrome, then red green and blue should be equal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!