Skip to main content
John Hawkinson
Inspiring
Sep 22, 2011 2:40 AM UTC
Answered

Getting a greyscale value from the Eyedropper?

Today, someone asked me how to pick up a gray value with the Eyedropper, and get a grayscale (K-only) color value in an otherwise CMYK document.

As we all know, the eyedropper tool gives RGB colorspace back, at least for raster images. So, fine, I get a gray rectangle with RGB:

Now, how can I convert this to grey? I can't really find a reasonable way. Converting to CMYK gives me 35/28/28/0, which is useles.

Converting to L*ab gives me 69/0/0, which seemed promising, but also is kind of a dead end:

In Illustrator, I have the choice for greyscale:

So, short of ducking over to Illustrator, is there a reasonable way to get the equivalent gray value out of InDesign?

I suppose one could write a script that uses math...but color math is hard, and it is easy to screw it up.

Of course, there is some amusing color science irony that if one tries to go the other way, say, from 39.0% K to RGB, one gets 169/171/174 . I suppose it relates to color profiles and whatnot (as does why Illustrator and InDesign may not end up with the same numbers).

Anyhow, any tips or convenient workarounds?

Sure would be nice if ID had "Grayscale" as an option like Illustrator...

This topic is closed to new replies. Start a new post to keep the conversation going.
Peter Spier
Peter SpierCorrect answer
Community Expert
Sep 22, 2011 12:17 PM UTC

I generally just go to separations preview and read it...

49 replies

Harbs.
Legend
Oct 7, 2011 11:54 AM UTC

Just a quick note that I posted an improved version of my script in my blog post here:

http://in-tools.com/article/scripts-blog/convert-colors-to-grayscal-in-indesign/

Translate
rob day
Community Expert
Community Expert
Oct 7, 2011 1:12 PM UTC

In your blog you're implying the eyedropper can't pick up accurate color from placed images, but as long as the link is an image (tiff, psd, jpeg) and the color space is supported by ID (RGB, Lab, CMYK) the eyedropper does get accurate source values. PDFs can have multiple color spaces, and there's no ID grayscale space, so in those cases the eyedropper returns the RGB proxy values.

Translate
Peter Spier
Community Expert
Community Expert
Sep 26, 2011 12:14 PM UTC

So why has nobody yet asked the obvious question?

If ID KNOWS the correct grayscale numbers (and CMYK numbers, for that matter, in CMYK images), which it clearly does in seps preview, WHY is it not possible to pick those up directly from placed rasters?

Translate
Harbs.
Legend
Sep 26, 2011 12:36 PM UTC

Oh. I'm sure it's possible.

You interested in attempting to write a plugin to do this?

There's just very little exposed to scripting about placed images...

Harbs

Translate
rob day
Community Expert
Community Expert
Sep 26, 2011 12:40 PM UTC

Oh. I'm sure it's possible.

Not until ID has a grayscale space.

Translate
Harbs.
Legend
Sep 25, 2011 9:22 PM UTC

I'm a bit late to this party, but how's this?

var color = app.selection[0].fillColor;

if(color.space == ColorSpace.LAB||

    color.space == ColorSpace.CMYK){

    color.space = ColorSpace.RGB

}

if(color.space == ColorSpace.RGB){

    var totalValue = color.colorValue[0] + color.colorValue[1] + color.colorValue[2];

    var averageValue = totalValue/3;

    color.colorValue = [averageValue,averageValue,averageValue];

}

var calcValue = 100 - (averageValue/255 * 100);

if(calcValue > 100){

    calcValue = 100;

}

if(calcValue < 0){

    calcValue = 0;

}

color.space = ColorSpace.CMYK;

color.colorValue = [0,0,0,calcValue];

Translate
John Hawkinson
Inspiring
Sep 25, 2011 9:40 PM UTC

Harbs:

I'm a bit late to this party, but how's this?

if(color.space == ColorSpace.RGB){
    var totalValue = color.colorValue[0] + 
        color.colorValue[1] + color.colorValue[2];     var averageValue = totalValue/3; } var calcValue = averageValue/255 * 100; color.space = ColorSpace.CMYK; color.colorValue = [0,0,0,calcValue];

Err. That does a terrible job! But what I didn't think of and just thought to try (by misreading your post!) is 100-(rgb/255). Which actually seems pretty good:

You can still see differences though. I think Peter's answer is still the best so far though...

Translate
Harbs.
Legend
Sep 25, 2011 9:47 PM UTC

I was tired when I wrote the script.

I fixed the code to what it should have been...

Translate
Community Expert
Sep 22, 2011 2:46 PM UTC

Pick up the color and change to lab. The "l" value can be used, just invert it. (i.e. "l" reading is 22, gray equivalent would be 78)

Translate
John Hawkinson
Inspiring
Sep 22, 2011 2:51 PM UTC

Jeffrey: Would you believe I tried that? At least in my color profiles,

that does not look anywhere close.

Translate
Community Expert
Sep 22, 2011 3:00 PM UTC

John, after a few more tests, my suggested lab method is flawed.

Translate
Peter Spier
Community Expert
Peter SpierCommunity ExpertCorrect answer
Community Expert
Sep 22, 2011 12:17 PM UTC

I generally just go to separations preview and read it...

Translate