aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Number of colors in an Image Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Number of colors in an Image " Watch "Number of colors in an Image " New topic
Author

Number of colors in an Image

John Eipe
Ranch Hand

Joined: May 23, 2008
Posts: 205
Hello,

I have a program that extracts the colors used in an image. The image is created by me using MSPaint (please take a look at the attached picture). I believe that the program should show atmost 7 unique colors. But i get many results. The code is given below:



Why does this happen?


[Thumbnail for circle.jpg]


www.cs-repository.info
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35439
    
    9
You'll probably find that the extra colors occur around the circles perimeters. Most drawing programs don't just paint a single line of black pixels, they add interpolated pixels to the left and right of the line in order to create a smooth appearance.

So there'll probably be lots of colors that are halfway between black and whatever color happens to occur on one side of the line. I'm sure high-end drawing apps have a way of preventing this; not sure about Paint, though.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Number of colors in an Image
 
Similar Threads
Logical operation on Image
Extracting Pixel Data From Fonts
How do i find out what color a certain pixel is?
why do my white and black pixels come out red and grey?
Image Animation...