Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to get the exact color value(RGB, HSB, or any other color space value that can be converted to RGB value) at any given point(preferably the point under the cursor) on a png image. Any tool for that? Thanks.

PS: To be more specific, I'm not asking for screen color picker, but PNG image color data picker. General screen color picker can not perfectly pick the exact color value in a PNG image, for example, alpha channel is missing.

share|improve this question
    
Or, as you mentioned PNG, do you also need the alpha channel's value? –  koiyu Oct 5 '11 at 8:08
    
@koiyu Sure, alpha channel is also needed. –  an0 Oct 5 '11 at 18:46

5 Answers 5

up vote 7 down vote accepted

Using ImageMagick:

$ convert image.png -crop '1x1+100+200' txt:-

Outputs, e.g.

# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: (236,236,236)  #ECECEC  rgb(236,236,236)

Or, if the file is PNG-24 file, it outputs e.g.

# ImageMagick pixel enumeration: 1,1,255,rgba
0,0: (  0,  0,  0,243)  #000000F3  rgba(0,0,0,0.952941)

At -crop option I've first defined the area to be cropped, which in this case is 1x1 pixels. Then I've defined the location of the crop relative to the North West corner, i.e. upper left.

Lastly I've converted the output to textual with txt:-. ImageMagick then outputs all the colors of the image to STDOUT (in this case there is only one color, as the image size is 1 pixel), meaning you could process it with normal shell techniques. So e.g. by piping the output to tail -n 1 you would get only the pixel info line.

If you need the pixel's color in any other colorspace, you should look at the aptly named -colorspace option.

†) Actually the location is relative to the specified -gravity value, but it defaults to "NorthWest".

share|improve this answer
    
Thanks, but can I get alpha channel value with this method? –  an0 Oct 5 '11 at 18:55
    
@an0 Yes. If you use the mentioned command with a PNG-24 file, you get an output of e.g. 0,0: ( 0, 0, 0,243) #000000F3 rgba(0,0,0,0.952941) –  koiyu Oct 6 '11 at 10:45

DigitalColor Meter (found in /Applications/Utilities) tells you the colour value (RGB) of the pixel your cursor is hovering over.

share|improve this answer
2  
I'm not asking for screen color picker, but PNG image color data picker. General screen color picker can not perfectly pick the exact color value in a PNG image. –  an0 Oct 5 '11 at 5:05
    
You asked for an RGB value for the pixel your cursor is hovering over. If you open the png file, and hover over the pixel, you will get the RGB value of that color, no? –  Mahnax Oct 5 '11 at 14:40
    
alpha channel is missing. –  an0 Oct 5 '11 at 18:48
    
Sorry I couldn't have been of more assistance. –  Mahnax Oct 5 '11 at 20:58
    
Alpha channel isn't part of RGB. –  Daniel Lawson Oct 6 '11 at 11:27

I found a feasible way on Stack Overflow by Roman Nurik:

In Photoshop's Info panel, you can choose 'Opacity' as a readout mode, though it will show up as a percentage and not as a real alpha value.

To enable it, simply open the Info window, choose Panel Options and then set the Second Color Readout mode to Opacity.

… But you need Photoshop for this. I still believe there should be simpler ways. Hope someone else can help.

share|improve this answer

If you don't have Photoshop, and don't want to spend the bucks just to get that feature, the FOSS (Free / Open Source Software) app GIMP will do the job for you.

www.gimp.org

share|improve this answer

colorhunter.com is what i managed to find while googling this same question. good luck

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
Hi Jenifer, just to let you know that this answer has been automatically flagged as low quality dur to length & Content (short with an link basically). If you can expand your answer to be more than a reference to another site, perhaps copy some of the apps features etc into the answer, it would read much better. –  stuffe Aug 8 '13 at 13:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.