Tuesday, August 14, 2012

Selecting a True Neutral Gray in Photoshop for 16-bit Image Layer Modes

(Note: I don't know if this information still applies to Photoshop CS6.)

The title of this article may sound confusing but what it addresses can seriously impact 16-bit image creation in Photoshop.  As I've mentioned before in my mixer brush articles, the mixer brush works best with 16-bit images, and certain layer modes like 'hard light' allow you to essentially blend with transparency when using the mixer brush, so long as you've filled the layer with the appropriate neutral color.  Unfortunately, Photoshop doesn't use the appropriate neutral color for layer modes requiring a 50% gray when working with 16-bit images.  Instead, it uses the same 50% gray required by 8-bit images.  This oversight results in a slight lightening of your image whenever you use a layer mode such as 'hard light' or 'overlay' and fill it with its neutral color.  And of course the problem compounds itself the more layers you use, as can be seen in this practice painting I did, in which about a dozen 'hard light' layers were used:



To make matters worse, you probably won't even notice the problem until you flatten your image - Photoshop seems to use 8-bit cached versions of your image to preview zoomed out views.  In other words, the 8-bit 50% gray will appear to be working properly so long as you're sufficiently zoomed out.  Zoom in close enough or flatten the image and the difference will become apparent.  I was able to more or less salvage the painting above by converting it to 8-bits/channel without flattening it - just like in the cached views, the layers worked fine when the image was converted to 8-bits/channel.

Fortunately, there is a way to use the correct 50% gray for 16-bit images - it just requires filling the layer manually by using the Fill command.  The process is easy to automate too, by using actions.

The Technical Details

As mentioned, Photoshop uses the same 50% gray for 16-bit layer modes that it uses for 8-bit layer modes (an RGB value of 128).  When converted to 16-bit, this 50% gray becomes a value of 16448.  To see this, you can create a new layer (Layer > New > Layer...), choose 'Overlay' as the mode, and select the checkbox to fill the layer with 50% gray.



After clicking 'OK', change the layer mode back to 'Normal' in the layers palette.  Now open the Info palette (Window > Info) and click on the eyedropper in the Info palette to select 'Actual Color' and '16-bit (0-32768)'.  When you hover the cursor over the image, the color values should appear in the Info palette.



The problem is, 16384 is the actual value you need for a 16-bit 50% gray, not 16448 (32768/2 = 16384).

Filling with a true 50% gray

To correctly fill a layer with a true 16-bit 50% gray, you'll need to avoid using the neutral color checkbox in the 'New Layer' dialogue and use the Fill command instead (Edit > Fill...).  Choose '50% Gray' from the 'Use' list and click 'OK'.



If you were to use the Info palette to check the color again, you would see that the RGB values now read 16384.

You can also easily automate this step by using actions to create your layers.  I make actions for all the layer types I regularly use (such as 'Hard Light') so they're just a click away.  I also have my actions change the background color to match the neutral color for the layer I'm working on.  This way, I can swap to the background color whenever I want to 'erase' marks on the layer without actually erasing any of the neutral color that the layer is filled with (thus allowing the mixer brush to continue to blend properly on the layer).

To select 50% gray as your background color, you'll first have to fill a normal layer with 50% gray by using the Fill command.  Next, click on the background color swatch to open the color picker and then click anywhere inside your image to select the 50% gray (you can't select the color from within the color picker because Photoshop's color picker only lets you select 8-bit colors).  Click 'OK' to close the color picker.  If you expand the action you've recorded to set the background color, you'll notice that the RGB values are set to 127.502 rather than the 8-bit gray values of 128.



---

And that's all. :)

Hopefully Adobe will fix this oversight in future versions of Photoshop, along with improving how cached images are previewed for 16-bit and 32-bit images.

(P.S. It'd be great if someone can confirm whether or not this problem still exists in Photoshop CS6.  I already used up my time for the trial before I discovered this problem.)

2 comments:

  1. FINALLY!!!! Someone with the same problem.
    And YES! I can assure you that this problem persists in Photoshop CS6.

    I just figured it out after trying to fix it for more than 3 hours. I work with 50-80 neutral gray layers in 16bit and I have a shift in brightness when I tried to export it/flatten it in 16bit mode.

    When I convert it 8bit and THEN flatten it - it works. but I cannot make a flat 16bit without a change in brightness.

    CS6 still needs a fix...

    ReplyDelete
    Replies
    1. Thanks for the reply. I posted the problem in Adobe's support forums and they seemed to eventually acknowledge the problem, so hopefully they'll fix it.

      Delete