Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an image (PNG or JPG) inside which there is at least one pixel of a certain RGB color I know in advance. I want to find the pixel(s) of that color

For example, I may have image.jpg, inside which I know some pixel has the RGB value 255,100,200. I want a program that will give me the list of pixels (if any) of that color in the image.

Anyone know of a tool to help me with that?

Thanks!

share|improve this question
2  
If your image is a JPG, then you can never be sure that there are a pixel of a certain colour, because JPEG is a lossy compression. With a PNG file, theoretically, you can do it. – petersohn Apr 9 '10 at 21:39
    
Good point! I'll work with PNG – ohadsc Apr 9 '10 at 21:59
up vote 5 down vote accepted

Install imagemagick. You can then create a list of every pixel in an image using something like:

convert foo.jpg foo.txt

The text file will contain every pixel in your image, 1 pixel per line:

0,0: (230,232,229)  #E6E8E5  rgb(230,232,229)
1,0: (230,232,229)  #E6E8E5  rgb(230,232,229)
2,0: (230,232,229)  #E6E8E5  rgb(230,232,229)
etc

If you want to find a single color, try:

FINDSTR E6E8E5 foo.txt > lightgrey.txt

to dump a file of every pixel containing the color E6E8E5. You can search for the rgb part of the line too, if you'd rather.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .