Photoshop CC 2019: Apply Image, Soft Light, and the 6-years old "50% Gray in 16-bit mode" bug (+ workaround)

  • 3
  • Problem
  • Updated 1 year ago
  • (Edited)
This is a bug possibly connected to an unfixed 6-years old bug regarding the value for 50% gray in 16-bit mode in some Photoshop dialog boxes, see: https://feedback.photoshop.com/photoshop_family/topics/photoshop_uses_the_wrong_50_gray_as_the_neutr...

The problem:
Using Apply Image (Blending: Add, Opacity: 100%, Scale: 1, Offset: -128) on two 50% gray (RGB values of: 16384) layers in 16-bit mode produces non-50% gray layer.

Steps to reproduce (with correct 50% gray value of 16384):
  1. Create an empty document in 16-bit mode (of any size)
  2. Create an empty layer, named "A". Delete the background layer.
  3. Fill the layer "A" with 50% gray (Edit>Fill: Contents 50% Gray)
  4. Use the Info panel, read RGB values in 16-bit mode of the Info panel: 16384, in 8-bit mode: 128
  5. Duplicate the layer "A", name it "B". Make sure the layer "B" is an active layer.
  6. Image>Apply Image: Layer: A, Blending: Add, Scale: 1, Offset: -128
  7. Read the resulting value: 16320 (in 16-bit mode of the Info panel), 127 (in 8-bit mode of the Info panel)
    Expected: 16384 in 16-bit mode of the Info panel and 128 in 8-bit mode of the Info panel.

Steps to reproduce (with incorrect 50% gray value 16448)
:
  1. Create an empty document in 16-bit mode (of any size)
  2. Create an empty layer (alt-click the "new layer" icon), named "A" in the "Soft Light" mode, with checked "Fill with Soft-Light-neutral color (50% gray)". Change the mode to Normal. Delete the background layer.
  3. Use the Info panel, read RGB values in 16-bit mode of the Info panel: 16448 (different from the previous one), in 8-bit mode: 128 (the same as the previous one)
  4. Duplicate the layer "A", name it "B". Make sure the layer "B" is an active layer.
  5. Image>Apply Image: Layer: A, Blending: Add, Scale: 1, Offset: -128
  6. Read the resulting values didn't change: 16448 (in 16-bit mode of the Info panel), 128 (in 8-bit mode of the Info panel)
Possible cause:
Apply Images uses an incorrect way for converting -128 (8-bit) to a 16-bit value.
Is: convert_8bit_to_16_bit(128) -> 16448,
Should be: convert_8bit_to_16_bit(128) -> 16384.

Workaround (with some losses):
We want to calculate: for layers A and B create the layer C with pixel values of:
"50% gray" + ((A - "50% gray") + (B - "50% gray")) (clipped at 100% black and white)

1) For layers A and B, shift the correct 50% gray point (16384) to the incorrect one (16448) using the Levels adjustment (NOT the Adjustment layer!) with "input white = 254". We are loosing some data.


2) Use the Apply Image as above.

3) Convert the result to the correct 50% gray point (16384) using the Levels Adjustment Layer, with "output white = 254".

We fall one short of all values near 50% gray (for example we get 16383 instead of 16384 for 50% gray), so we have to add "+1" to all pixel values in 16-bit mode. Tricky. Create a Fill Layer, Mode: Linear Dodge (Add), Opacity: 1%, Fill: 50%, Color #010101.

Select layer A, Merge (Ctrl+E). Delete layer B.
Photo of DS

DS

  • 11 Posts
  • 1 Reply Like

Posted 2 years ago

  • 3
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 16861 Posts
  • 2828 Reply Likes
Hi Damian, have you tried the 20.0.1 update? Please let me know if that fixes your issue. Thanks!
Photo of DS

DS

  • 11 Posts
  • 1 Reply Like
Hi Jeffrey. No, it is not fixed in the 20.0.1.

Chris Cox himself stated that the correct middle value for 16-bit (as implemented in Photoshop as "15-bit + 1") is 16384 (here: https://forums.adobe.com/message/7569532#7569532).

Adobe engineers (or anyone else) should be able to use the steps I provided in the section "Steps to reproduce" to check if the problem is fixed.

I cannot edit the original post, but I should add (after point 1.) : "zoom to 100%".

In low zoom levels the readout in the Info panel is incorrect for 16-bit mode. This is caused by another several years old bug: https://feedback.photoshop.com/photoshop_family/topics/incorrect-rendering-of-color-and-banding-when...
(Edited)
Photo of Pete Green

Pete Green, Customer Advocate

  • 780 Posts
  • 166 Reply Likes
Official Response
This should now be fixed in the Photoshop 20.0.3 release.
Feel free to update Photoshop and let us know if this is resolved for you.

To update Photoshop CC to 20.0.3, click "Update" in the Creative Cloud desktop app next to Photoshop CC.
More detailed instructions for updating

Thank you for the report Damian!
Regards,
Pete
Photo of DS

DS

  • 11 Posts
  • 1 Reply Like
Hi Pete,

I'm afraid the problem is NOT fixed. In version 20.0.3 the problem is even worse than before :( Now there is no easy way(*) of getting idempotent apply image with aforementioned settings (that is: creating a gray value that would not be affected at all by applying the Apply Image). It seems that you have corrected the gray value in one place (the "New layer" dialog) but forgot to correct it in the "Apply image" function.

From your own manual ( https://helpx.adobe.com/photoshop/using/channel-calculations.html#add_and_subtract_blending_modes ), the "Add" mode in Apply Image should work as follows: "Add mode divides the sum of the pixel values by the Scale amount, and then adds the Offset value to the sum."

Using the 50% gray color = (128,128,128) = 0x808080, filling with that color and using the info panel to read out the 16-bit values, we get the gray value of 16384. So we should be able to assume that 128 (8-bit) == 16384 (16-bit).

For 2 layers containing "Photoshop-correct 16-bit 50% gray" (that is: 16384) the Apply Image settings {Blending: Add, Scale: 1, Offset: -128}, we should get (16384+16384)/1 - convert_to_16bit(128) = 2 * 16384 - 16384 = 16384.

But in the current version (20.0.3) of Photoshop we get an incorrect value: (16384+16384)/1 - convert_to_16bit(128)=16320. From that we can calculate convert_to_16bit(128) = (16384+16384)/1 - 16320 = 32768-16320 = 16448 (wrong value).

(*) To get a gray value that doesn't change after Apply Image, we have to produce the 16448-gray value. Fortunately the old trick still works: create the 16448-gray layer, create new fill layer with the color of #010101, fill 75%, opacity 66%, blend mode Linear Dodge (Add). Merge those two layers to get a 16448-gray layer.  Now proceed from the step 3 of the section "Steps to reproduce (with incorrect 50% gray value 16448)". You also can use the method from the section: Workaround (with some losses).