开发者

Identifying pixel colors from image file

开发者 https://www.devze.com 2023-03-30 19:10 出处:网络
How can i check the colors of specific pixels in the image? The example of what im looking for is map gen开发者_JS百科erating from a png file in thislink First hit on Google: Getting and Setting Pixel

How can i check the colors of specific pixels in the image?

The example of what im looking for is map gen开发者_JS百科erating from a png file in this link


First hit on Google: Getting and Setting Pixels in a Buffered Image

// Get a pixel
int rgb = bufferedImage.getRGB(x, y);

// Get all the pixels
int w = bufferedImage.getWidth(null);
int h = bufferedImage.getHeight(null);
int[] rgbs = new int[w*h];
bufferedImage.getRGB(0, 0, w, h, rgbs, 0, w);

You can also go through the bufferedImage.getRaster().getPixel(...) method.


the solution can be found here : http://www.roseindia.net/java/java-get-example/get-color-of-pixel.shtml

0

精彩评论

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