What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Unexpected Characteristics of Black to White Gradients


thebestcpu

Guru
Messages
2,994
Likes
2,760
Minor Yet Odd Gradient Anomalies

This post may be FYI, but I would not mind the enlightenment if someone has better knowledge about what I share below.

I required a simple linear (yet pretty exact) B to W Gradient in Photoshop. I just used the Black to White default gradient in Photoshop, yet I noticed down my workflow that it was not linear.

According to what I have read in Photoshop documentation, both the B to W Gradient and the Foreground to Background Gradient (with foreground set to black and background set to White) should yield a linear gradient.

I discovered that neither creates a linear gradient.
I also discovered that even though the documentation says that the smoothness setting should make no difference for simple two-point gradients, it makes a big difference.
I also discovered that the B to W gradient has a slight color tint while the F to B Gradient does not.

For many image and graphic design projects, the difference is not significant and likely inconsequential, yet in some cases, it can create problems, including blocking up blacks.

Let me start with an image of the gradient editor to show the possible settings:

Gradient-Panel-Image.jpg

I have highlighted the default Black to White and Foreground to Background built-in gradients. They both only specify a starting color, end color, and smoothness of 100.

Smoothness may be misleading to some as smoothness set to 100 means the gradient transitions between color points are rather than linear, done via a spline curve, so there are no sharp transitions.
Smoothness set to 0 means that the transitions between color points are linear and may have sharp transition points.

Adobe documentation indicates that if you have simple two-point gradients, the smoothness setting should have no impact on the Gradient: " With a simple gradient with two stops and a default midpoint, theoretically, smoothness has no effect. The stop values are already in a line. The smoothness 0 value goes in straight lines connecting stops and midpoints, while a 100% value does a spline curve."

As I will show below, that is not true.

I will show five different gradients that are all Black to White. The first is a manual gradient (tedious), two using the B to W gradient with both extremes of smoothness and the F to B Gradient with both extremes of smoothness.

First is the exact linear Gradient I created manually (not with the gradient editor). On the left, I show the output to input curve extracted from the Gradient on the right. This Gradient is an actual linear gradient.

Screen Shot 2022-11-13 at 7.30.59 PM.jpg


Second, here is the B to W default gradient with the default smoothness of 100 (which should still be linear). Not only is it not linear, but it also has a slight color tint between green and cyan (you can see the separation of the RGB transfer curves.

Also, note that the blacks are somewhat crushed in the dark regions of the curve.


Screen Shot 2022-11-13 at 7.31.11 PM.jpg


Third, here is the B to W default gradient with the smoothness set to 0 (officially linear)
The smoothness setting is not supposed to make a difference on these simple gradients, yet it does. This "more" linear version is not the default version.
There is still a bit of color tint, and the low-end blacks are still crushed.

Screen Shot 2022-11-13 at 7.31.22 PM.jpg


Fourth, here is the F to B default gradient with F set to Black, B set to White, and smoothness set to the default 100.
Very similar to the B to W gradient, except for no color tint. All the RGB transfer curves are on top of each other. No clue why the F to B gradient is different than the B to W gradient, yet it is.

Screen Shot 2022-11-13 at 7.31.32 PM.jpg

Fifth is the F to B default gradient with the smoothness set to 0.
Again no color tint yet still some black crushing at the dark end of blacks.

Screen Shot 2022-11-13 at 7.31.40 PM.jpg

I decided to post when I found the added color tint.

If you can shed some light on the "whys" of these differences, it would be appreciated, yet you can also leave this as an FYI of another strange Photoshop characteristic.

John Wheeler
 

Rich54

Guru
Messages
1,739
Likes
3,425
John,
Your post reminded me of this one from several years ago, which you were very involved with. I bring it up because in that old post it talks about Adobe having created old gradient algorithms with glitches in them, and then essentially refusing to ever change or update them.


It's striking to me how different the standard packaged gradients are from your manually-created exact gradient. If you look at them one above the other—like below—they're not even close. Also, the horizontal midpoint of the lower (B to W) gradient is nowhere near 128, 128, 128, which is what we'd expect.

I have no intelligence to add to this. But visually, when I look at the B to W gradient below, I see equal thirds (highlighted by the red lines) of very dark tones, medium tones, and very light tones. It's not mathematically linear, but it does have a certain visual appeal. I wonder if Adobe, at some point in the dim past, once thought to create various "artistically" non-linear gradients, got halfway through the project, and then changed their mind after the code was written. They got stuck with a lot of quirky gradients with no good explanation for them.

Rich


1668409088576.png
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
Thanks @Rich54 for the comments and also for the link on prior related post from 7 1/2 years ago. Apparently my own internal memory buffer no longer accommodates remembering a post from that long ago :laugh: I did search on PSG yet that one did not come up for me.
I guess its my turn to bang my head on the wall and probably the same conclusion from the prior post.
Yet, that post did remind me to check some other things out such as creating a new Layer with a gradient as that has more options. I will reply back with what I find.
I wish I had working versions of older PS versions with their supported OSes to compare what those versions created then and if there were changes until today.
I noted that I did not see the large color tone separation I am seeing today.

As additional information, what triggered me to go look at details again was simply creating a gradient and apply a Posterization Adjustment Layer as shown below. I created a B to W gradient with Smoothness = 100 by drawing horizonally across 256 pixel sqauare with beggining and ending guidelines to snap to. Then adding a posterization adjustment Layer with the setting at 10. Note that not only are the 10 segments to equal, yet there was some green/cyan colors surround each of the transitions. Pretty ugly. If someone has a CS6 version working it might be interesting to see if the same results are found:

Screen Shot 2022-11-14 at 9.41.25 AM.jpg


I will try a few more gradient creations and report back spurred on by that original post from 7 1/2 years ago.
Thanks again
John Wheeler
 

Rich54

Guru
Messages
1,739
Likes
3,425
John,
Here's a new wrinkle to the mystery. I have Photoshop CS5. I just created several gradients and compared them to each other, as well as to your exact gradient that you posted above. (I rescaled your exact gradient to be the same size as the ones I just made, but I held down the Shift key to constrain proportions, so I'm pretty sure the result is valid.)

I'm also attaching my PSD file with all the various gradients superimposed on each other in separate layers. If you toggle the layer visibility on and off, you can compare any one gradient to any other and visually see anything that changes.

Here's what I found:
  • In CS5, the Foreground to Background gradient is exactly the same as the Black to White gradient.
  • There are visible differences in each of these gradients at Smoothness=100% vs. Smoothness=0%. But those differences are fairly small.
  • When I set Smoothness to 0%, the resulting gradient looks exactly the same as your manually-created exact gradient.
  • In no case do I get any gradients that look like the one you posted above where I commented that it resembles equal thirds. All the CS5 gradients are visually quite close to your exact gradient.
  • Unfortunately, I don't know how to create the line graphs that you did, showing the actual shape of the curve.

Gradients Using Photoshop CS5.jpg
 

Attachments

  • Gradients v2 Using Photoshop CS5.psd
    1.6 MB · Views: 2

thebestcpu

Guru
Messages
2,994
Likes
2,760
Thanks @Rich54
That was very helpful to see that we did not have the same gradients in CS5. I did confirm with the transfer curves of your gradients that it does indeed follow your description in your post.
That lead me to what I believe solves part of the problem and that is that the recent versions of Photoshop (either version 22 or version 23) included new gradient modes in the tool panel shown in the cut and paste:

Screen Shot 2022-11-14 at 2.16.38 PM.jpg

I had not reviewed this new feature and apparently it defaults to perceptual which gives the gradients the extra curve. Other choices are linear and classic.
Also back in PS 2020, they intrduced the "new" gradient panel where they refer that you access the legacy gradients if you want them.
So quite a bit has changed
I will plot out the new curves with the three new interpolation methods to show the differences

However, it does not explain the tinting that occurs when using the B to W gradient curve. That is still a mystery (bug?).

Thanks again for you help tracking down these differences. More to come in a later post.
John Wheeler
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
@Rich54

With the holidays, I have not had a chance to post what I found out.
As a recap, under certain B to W gradient modes a greenish color tone is introduced.
Turns out this is a bug in the more recent versions of Photoshop (2022 including most recent version 23.5.3) and 2023 including most recent version 24.0.1)
I am using a 2021 MacBook Pro M1 apple silicon yet the issue occurs whether I run in Apple Silicon natively or in emulation mode running "Rosetta"

The bug requires using the preset BtoW gradient and also only with the Mode/Interpolation option set as Perceptual (only available in recent versions of Photoshop).
This bug occurs for all values of the gradient smoothness slider.
The bug does not occur for other gradients nor when the smoothness value is changed.
It does not occur in the Classic nor Linear Interpolation mode

The downside is that the Perceptual gradient method / Interpotlaion mode is turned on by default in the newer version of Photoshop and all you have to do is select the BtoW gradient preset.

The link below to the Adobe community forum indicates that it was supposedly fixed in PS version 23.4 yet it has not been fixed.

A simple workaround is to edit the beginning and ending colors to the 0,0,0 and 255,255,255 respectively and it goes away. You can make your own B to W preset, or use the Foreground to Background gradient and set the beginning and ending color to 0,0,0 and 255,255,255 respectively.

I will post what I have found on the Adobe Community Forum that the problem is still not fixed and include ezample graphics.

So the source of the "Minor Yet Odd Gradient Anomalies" has been tracked down and is a real Adobe Photoshop bug
John Wheeler

Here is the link to the discussion of the bug: Gradient Bug Reported to Adobe on its Community Form"

And for those not familiar with the new Method / Interpolation modes here is a broad brush description of them in Adobe helpx URL:
https://helpx.adobe.com/photoshop/using/gradient-interpolation.html
 

Rich54

Guru
Messages
1,739
Likes
3,425
Lots of good sleuthing to then discover it's a software bug. Whenever I need a gradient, I almost always use Foreground to Background and then set my own colors. To be honest, I never really noticed that the preset Black to White gradient even existed. Bug aside, I do like that Adobe gives more gradient options in the new versions of PS.
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
I have an update on the gradient bug as I was preparing to submit the bug report to the Adobe Community Forum.
There is a bug yet the root cause was a little different than I thought we some more detailed examination.

To get a clean bug report, I deleted all of the gradients in Photoshop and then loaded only the default Gradients back in.
When using the default gradients, I could not reproduce the problem. This felt as if it was pilot error or corrupt gradients yet that was not the case.

As it turns out, for thsoe that prefer using the older presentation of gradients in the gradient panel you can load the Legacy Gradients by using Windows > Gradients and then using the 3 line icon dropdown load the "legacy Gradients". I was one of the PS users that had loaded the Legacy Gradients and renamed the Group as "My Presets" as you can see in the a previous sreen shot right above the gradient sample chips (image repeated here):

Gradient-Panel-Image.jpg

Well it turns out that the loaded Legacy Gradient has an error. When examining the first black color starting point, instead of the gradient starting with RGB of 0,0,0 it acutally starts with 0,0,2
Using this gradient in Perceptual mode makes for a green tone, when using the Classic mode a very slight blue tone, and when using the Linear mode, there is very minimal color tone yet it is there as well.
When either correcting the Legacy black starting point to 0,0,0 or just using the Default Black,White gradient the problem goes away totally.

I verified that using the Legacy gradients in Photoshop 2021 does not have this problem yet both PS 2022 and PS 2023 both pull in incorrect Legacy gradients.

So the problem only impacts those that use the Legacy gradients in PS 2022 or PS 2023 with the Black,White Legacy gradient. That explains why not everyone was seeing the problem.

So a good heads up for the few that have imported the Legacy gradients in PS 2022/2023.

FYI
John Wheeler

PS - I will be posting this information on the Adobe Community Forum
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
SIGNIFICANT UPDATE

Here is another followup to the unexpected characteristics of PS Gradients.

I dug in and found the root cause and determined quite a few of the Legacy Default Gradients are subject to problems (not the regular Default Gradients). I also provided a Replacement Legacy Default Gradient Preset file that fixes the problem for all affected Legacy Gradient Presets.

I documented my findings at the Adobe Forum at:Anomalies in Legacy Default Gradients when using Gradient Method of Perceptual or Linear

Besides the Replacement Gradient File I also included links to a detailed text file that details out all of the Legacy Gradient Presets which includes which gradients have the potential problem. I also listed the details of the regular Default Gradient Presets which shows why they don't have the problem.

I personally moved over to using the Replacement Legacy Gradient Preset file until if and when Adobe does an update to remove the problem. I am hoping that providing the details to Adobe will help with higher motivation to correct the problem (pretty easy fix/workaround).

I won't repeat the details here so if interested just use the link.

John Wheeler
 

Top