I am trying to get the different amount of colors inside an image in java, but I don't know if there is a library for this propose of not. the project is about finding out the different colors from one image, and then print out the name of the colors. any idea??? please help me if you have any answer.
+2
A:
You can turn an image into a BufferedImage and call getRGB(int x, int y) to get the rgb for each pixel. Then you can use one of the many color websites such as this one or this one to map the rgb to a color name. Just find the named color which is the closest in distance to each rgb in the image.
Jay Askren
2010-07-09 16:33:37
+1
A:
Java has the Java Advanced Imaging (JAI) library which is built to allow stuff like this.
Eric
2010-07-09 16:56:58
Does JAI have the ability to return all of the color names from an image? I don't see it in the api. It does have the ability to blur, sharpen and run other algorithms on images, but I don't see how that is related to the question.
Jay Askren
2010-07-09 17:04:08