June 1, 2011

ASK MORDY: Eyedropper Tool Woes

This question comes in from Dan:

If I have a white rectangle with some transparency applied and it sitting directly over another rectangle with a red fill, what you end up seeing where they overlap is not red, not white but pink. Not rocket science....I know. However if I want to use the eyedropper to pick up that pink color....I cannot do it. I've been researching and fiddling with eyedropper settings but no matter what I do, eyedropper only picks up "white"; it sees the objects, not the color. If I take a screen shot of Illustrator and place that flattened 2-dimensional image back into Illustrator, now eyedropper "sees" the pink and picks it up if I shift-click. How do you make eyedropper pick up the resulting pixel color....not the fill color when you're dealing with transparencies? 

That's a great question, Dan. Just to illustrate the "issue" here, say you have two shapes -- a yellow and a blue rectangle -- that overlap. The blue shape is set to multiply, so where the two shapes overlap, you see green. If you use the Eyedropper tool to sample the area that "looks" green, you'll actually pick up blue. That's because the Eyedropper tool is picking up the fill attribute of the rectangle -- not the final color that's a result of the transparent effect. 

Sampling from the "green" area will actually result in a blue color.

As Dan mentioned, you *could* turn the artwork into an image (although you don't have to take a screenshot -- you could just rasterize the artwork by selecting both shapes and choosing Object > Rasterize). When sampling from a raster image, you can press and hold the Shift key while using the Eyedropper tool to get pixel values. While that's true, you still have to go through the trouble of rasterizing your artwork. More so, the color that you're sampling is actually an RGB color sampled from the screen. So it's not entirely accurate either.

Sadly, this is a deficiency in the way the Eyedropper tool works. It can only sample pixels from rasters, and if it finds an object, it grabs it attributes, not the color that is seen on the screen.

So what to do?

Well, first, in order to get the real color of that overlapping area, we'll need to select both shapes and choose Object > Flatten Transparency. This will actually break up the artwork so that you'll have a physical third shape. This shape will contain the resulting color of the transparency. You could then use the Eyedropper tool to sample that new shape.

But that doesn't really work for me, as I will lose my editable artwork. Let's step back for a second though -- what if we just ignore the Eyedropper tool altogether? I mean, all we're after is the color. What if I told you I could hand you that color as a swatch? Would that work for you? It will take a few steps to do it, but if we record an Action to do it for us in a single click (or keystroke), that might fit the bill. Let's take it one step at a time:

1. Select the overlapping artwork.

2. Open the Actions panel and click the Create New Action button. Give it a name (and if you'd like, assign it to a set). If you want to perform this action later via a keystroke, assign a Function key as well. Then click Record.

3. Choose Edit > Copy.

4. Choose Edit > Paste in Front.

5. Choose Object > Flatten Transparency and then click OK (the default Medium setting is fine for our needs).

6. Open the Swatches panel, and from the bottom of it, click the New Color Group button. Click OK when the New Color Dialog appears.

7. Choose Edit > Clear.

8. In the Actions panel, click the Stop Recording button.

9. Make sure that the Toggle Dialog settings are off for the steps in the Action (otherwise the dialogs will appear whenever you run the Action).

OK, you're done. Now try it out. Create some overlapping artwork that has transparency. Select the artwork and Play the Action. Now you'll find a swatch in your panel that contains the exact color of that overlapping area.


Dan said...

Thanks Mordy, I tried the technique and it worked! Its a great solution as ultimately I want to lift a color and add it to my swatches; your technique does that automatically.

mckibillo said...

wow! what an awesome tip! Mordy, the way your mind works, breaking this down... genius, man. SRSLY.

Alexander said...

Holding the Shift button also helps.

If we fill the top object with a gradient the eyedropper tool will sample the overlapping color with the shift-button pressed.

In the example provided the gradient should be from blue to blue :) A bit clumsy, but visually it will be the same.

P.s. Writing it for the second time to pass through your spam filters or whatever

Boreale said...

VERY interesting tip !! :-)
Thanks to both of you, for the question, and for the answer ! :-)

Kathleen said...

Wow! So useful. I'm off to write my action now :)

Tom said...

Quick fix: use Snag-it or similar utility and marquee around the color you want. Paste that snag back into your document - sample the color and delete the pasted object. Done.

Gary Spedding, Ph.D. said...

Very nice. Also drag over the combined shapes to InDesign to auto-load those colors into its swatches panel. Maximize the mileage out of creating these swatch colors in Illustrator. To save for use in other InD documents save as a snippet! Cool interapplication stuff here.

learn chinese said...

thanks Mordy, i really enjoy your posting. thanks

eeeky said...

That didn't seem to work for me. Could it be because I'm in CMYK mode?

Anonymous said...

Many thanksss, it helps!