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 linkFirst 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
精彩评论