开发者

Identifying pixel colors from image file

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜