Matching Color of Transparent Rectangle to Solid Rectangle

Z
Posted By
zda
Oct 9, 2008
Views
1123
Replies
7
Status
Closed
Hi,
I have a solid color rectangle on a layer.

I would like to create several similar rectangles on different layers with different opacity levels (i.e. 90%/75%/50% etc), that will match the solid color rectangle exactly, when they are against a white background.

I used Hue/Saturation on the transparent rectangles to approximate the solid color, but the eyedropper shows that I am a of couple values off. Is there a way to accurately match these colors exactly?

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

M
Mylenium
Oct 9, 2008
Have you used persistent eyedroppers (Alt+eyedropper tool) to nail down the colors while you are adjusting? Funnily I could easily do this easily with a few expressions in After Effects, but for PS no such solution presents itself.

Mylenium
Z
zda
Oct 9, 2008
Hi Mylenium,
thanks for the tip-I didn’t know about persistent eyedroppers!

Here is the problem though:
a) I have a layer with a solid green rectangle: RGB 134, 174, 154
b) I duplicate that layer, move it so the 2nd rectangle is adjacent to the 1st, and make that layer 90% opacity (so it looks lighter against the white background)
c) I check the RGB level of the 2nd rectangle: RGB 146, 182, 164
d) So far, so good-two eyedropper samples:
#1 RGB 134, 174, 154
#2 RGB 146, 182, 164
5) I go to Adjustments/Hue Saturation
6) Suddenly, the Info panel only shows sample #2 as 134/134 174/174 154/154!!!#1 doesn’t show anything.

I’m guessing it is ignoring the opacity setting when the requestor is open? (since the 2nd rectangle IS the same color as the 1st rectangle when it is 100% full opacity)

This seems like such an elementary thing to do..not sure what I’m missing 😛
GA
George_Austin
Oct 10, 2008
ZDA,

You did not specify the layer blend mode, but your numbers indicate it was Normal, and that white was your background color.

The color value at any pixel site in a given channel will be the layer value in that channel times the layer opacity plus the underlying value times (1 – layer opacity).

Thus for your patch in layer #2 with underlying white, you observe red to be (134 x 0.9) + (255 x (1-0.9)) = 120.6 + 25.5 = 146. In the same way, blue and green are 182 and 164 respectively.

Perhaps understanding the above will help you decipher the effects you observe. As for adjusting the values via Hue and Saturation, it is difficult to deduce what’s going on without knowing the H&S slider settings.
Z
zda
Oct 10, 2008
Hi George,
thanks, that is actually exactly what I resorted to…math :p In order to make it work, I decided to make another SOLID rectangle where every value was .10 "lower" in value than the original, (using a similar formula as you noted). I then made that rectangle 90% opacity, and….got closer :p But then I could just keep changing the fill color until the RGB values became exactly equal.

I don’t really use the replace/similar/etc. color sliders, so I’m not that familiar with how they work. But they don’t seem to control RGB values individually-only the direct swatch editor seems to allow direct RGB value entry, and of course, that is useless for a layer with opacity settings, as it only shows the 100% opacity value.

I still find it hard to believe that I had to resort to doing calculations just to match two colors. There must be an easier way 😀
GA
George_Austin
Oct 10, 2008
"…But they don’t seem to control RGB values individually-only the direct swatch editor seems to allow direct RGB value entry, and of course, that is useless for a layer with opacity settings, as it only shows the 100% opacity value…"

The above excerpt suggests you are not really grasping the role of opacity. Let me take another shot at explaining it and then I promise not to pound on you further.

Opacity does not change color values in a layer. A pixel with RGB values in a layer of 134/174/154 will still be 134/174/154 no matter what the layer opacity. To appreciate that, underly the layer not with white but with transparency, and check the layer color values as you change its opacity—they will not change.

What you see and the info palette shows, however, is a combination of the layer color value and that of the substrate. The percent of the top layer value contributing to the result is its opacity. The percent of the substrate’s color value added is the top layer’s transparency, which is nothing more than the inverse of its opacity.

Thus, in normal mode, the resultant color value is a mixture of the layer value and the substrate value, the proportions of which are fixed by the opacity. Again, layer opacity does not change layer color values but, rather, the net effective color value of the layer in combination with whatever lies beneath it. And probably needless to say except that some users think of it as "nothing", the values of a white substrate are 255/255/255—color to the max!
M
Mylenium
Oct 10, 2008
George covered the facts nicely. I guess the more interesting question at this point is actually what you plan on doing with the setup. If it’s going to be printed somehow or will be put on a website as one of those optical illusion games, the colors will shift around, anyways, so your efforts may end up as having been not so productive…

Mylenium
GH
Gernot_Hoffmann
Oct 10, 2008
True, but we are facing an exciting future:
Not flattened PDFs will appear all over the
world on all devices with unique&correct colors,
because everbody HAS to use the Adobe Print Engine:
Original:
<http://www.adobe.com/designcenter/creativesuite>
/articles/cs3ip_transp.html
Use this short version:
<http://tinyurl.com/4gwzq4>

It’s only a small step to cast George’s explanations
into formulas:

R1,G1,B1 = C1 opaque sample, C is one of R,G,B
R2,G2,B2 = C2 transparent sample with opacity k=0..1

Float
C1=k*C2+(1-k)*255
Float, if k>0
C2=(C1-(1-k)*255))/k
Byte, if C2>=0:
C2=Round(C2)

Best regards –Gernot Hoffmann

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections