13

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.

3

5 Answers 5

20

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".

3
  • Thanks, but can I get alpha channel value with this method?
    – an0
    Oct 5, 2011 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) Oct 6, 2011 at 10:45
  • For some colors, I get color names in text form (e.g., 'black' or 'teal') instead of their RGB values using this method. This post on the imagemagick forums has another solution that seems to work but is a lot more complex. imagemagick.org/discourse-server/viewtopic.php?t=13694#p46473
    – Wyatt Ward
    Oct 29, 2018 at 13:38
7

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

6
  • 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, 2011 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? Oct 5, 2011 at 14:40
  • alpha channel is missing.
    – an0
    Oct 5, 2011 at 18:48
  • Sorry I couldn't have been of more assistance. Oct 5, 2011 at 20:58
  • Alpha channel isn't part of RGB.
    – Daniel
    Oct 6, 2011 at 11:27
2

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.

1

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

-2

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

1
  • 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, 2013 at 13:17

You must log in to answer this question.

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