Jump to content
You must now use your email address to sign in [click for more info] ×

Vibrance Saturation slider algorithm?


Recommended Posts

Saturation in the Vibrance adjustment layer isn't the same as HSL saturation, but it also doesn't seem to be basic 30/59/11 perceptual values either. Turning it right down and doing a Difference with a PT layer with an assortment of formulae I can't quite pin its calculation down.

Can anyone tell me how this is calculated, especially in slider fully left (desaturation)?

Thanks!

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

  • Staff

I do not think that we are in a position to discuss the algorithms and I am not about to ask the devs to justify every line of code. The developers need to get on with...developing. Sorry, but this is not what these forums are generally for.

Are you suggesting there is a bug at the slider extremity?

Patrick Connor
Serif Europe Ltd

"There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon

 

Link to comment
Share on other sites

  • 3 weeks later...
On 3/17/2021 at 10:02 PM, dmstraker said:

Saturation in the Vibrance adjustment layer isn't the same as HSL saturation, but it also doesn't seem to be basic 30/59/11 perceptual values either. Turning it right down and doing a Difference with a PT layer with an assortment of formulae I can't quite pin its calculation down.

Can anyone tell me how this is calculated, especially in slider fully left (desaturation)?

Thanks!

I don't know if Photo handles this euqal to PS. Here you find some more info about the definition.

https://www.photo-mark.com/notes/analyzing-photoshop-vibrance-and-saturation/

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

On 3/24/2021 at 10:53 AM, Patrick Connor said:

I do not think that we are in a position to discuss the algorithms and I am not about to ask the devs to justify every line of code. The developers need to get on with...developing. Sorry, but this is not what these forums are generally for.

Are you suggesting there is a bug at the slider extremity?

No suggestion, no pressure, not asking for devs to take their noses off the grindwheel. Just trying to understand. I'm an old techie and endlessly curious.

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

On 3/17/2021 at 4:02 PM, dmstraker said:

Saturation in the Vibrance adjustment layer isn't the same as HSL saturation, but it also doesn't seem to be basic 30/59/11 perceptual values either.

Curious about what the "basic 30/59/11 perceptual values" refer to.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

Make black and white with 30% red, 59% green, 11% blue. Reflects perception of colour brightness. We see blue as darkest, then red then green. 

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

22 minutes ago, dmstraker said:

Make black and white with 30% red, 59% green, 11% blue.

You lost me. Whatever these percents are, how can that make black and white, perceptually or otherwise?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

3 minutes ago, R C-R said:

You lost me. Whatever these percents are, how can that make black and white, perceptually or otherwise?

That is using the B & W adjustment layer

Strictly speaking it should also have 89% yellow, 41% magenta and 70% cyan

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

19 minutes ago, Old Bruce said:

That is using the B & W adjustment layer

So what does that have to do with the Vibrance adjustment?

While the exact algorithm is not known, it seems obvious that it applies a non-linear (possibly exponential?) curve that reduces or eliminates the chances of over saturating the brightest colors, even with the sliders at their maximums.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

12 hours ago, R C-R said:

So what does that have to do with the Vibrance adjustment?

While the exact algorithm is not known, it seems obvious that it applies a non-linear (possibly exponential?) curve that reduces or eliminates the chances of over saturating the brightest colors, even with the sliders at their maximums.

Apologies for the confusion. If it will help, more detail is below that hopefully answers your questions and explains my motivations.

1. Monochrome conversion

In a colour image, Red, Green and Blue have different values in each pixel. When Red, Green and Blue values in a pixel are equal, the result is white, grey or black (in other words, monochrome). The puzzle in converting to monochrome is how to shift the Red, Green and Blue in each pixel so they are equal. Examples of this include:

  • Take the average. So if R=100%, G=0 and B=0 (in other words bright, saturated red), the monochrome pixel value is R=33%, G=33%, B=33%
  • Go half-way between the maximum and the minimum.  So if R=100%, G=0% and B=0%, the maximum is 100% and the minimum is 0% the monochrome pixel value is R=50%, G=50%, B=50% (which will make the pixel a mid-grey, which is brighter than the first method).
  • Use the gap between the maximum and the minimum. So if R=100%, G=0% and B=0%, the maximum is 100% and the minimum is 0% the monochrome pixel value is R=100%, G=100%, B=100% (which will make the pixel even brighter - in fact it will be white).

So the question is 'What method will you use to convert the colour image into monochrome (ie black and white)?'

A further problem is that when we look at different colours, we perceive them to be of different brightness. Just taking the primary and secondary colours (red, yellow, green, cyan, blue ad magenta), Yellow is seen as bright, while Blue is seen as dark, with the other colours in between. If you use any of the calculations above to create monochrome, a yellow and a blue pixel will both have the same brightness. This can make an image look poor (a good example is a bunch of different coloured flowers which all come out in similar shades of grey).

So someone found that when converting to monochrome, it worked well to take different amounts of Red, Green and Blue. Because of the eye's sensitivity to different colours, within each pixel in the coloured image, you take about 30% of the Red, 59% of the Green and 11% of the Blue and then create the monochrome pixel by setting Red, Green and Blue all to the same value from this calculation. As a formula, this is R*0.30+G*0.59+B*0.11. The result is a monochrome image that looks more realistic.

  • So if R=100%, G=0% and B=0%, the 30/59/11% calculation is 0.3*100%+0.59*0%+0.11*0% = 30%. So pure red appears as a darkish grey.
  • if R=0%, G=100% and B=0%, the 30/59/11% calculation is 0.3*100%+0.59*100%+0.11*0% = 59%. So pure green appears as a lighter grey.

In this way, different colours, even when they have the same pixel value are converted to appear as different shades of grey.

2. The Vibrance question

A way in Affinity Photo to create a monochrome image is to turn down the saturation. A question is whether this takes account of the 30/59/11% tweak above.

When you turn down the Saturation in the HSL adjustment, it uses a formula that means a similarly saturated Yellow and Blue will appear as the same shade of grey. In some situations this is just fine, but if you want 30/59/11% conversion, so the human eye makes more natural sense of the colours, you need a different method.

The Vibrance adjustment also has a Saturation control, but turning this down has a different effect to the Saturation control in HSL. I had thought the result was just from using the 30/59/11% calculation, but it seems to be slightly different.

A way to get a perfect 30/59/11% calculation is to use Levels and simply change the RGB drop-down control to Grey.

3. My motivation

I am both a curious old techie and the author of the InAffinity YouTube channel where I explore and explain Affinity Photo. In this, I talk about such things as the 30/59/11% thing and the difference between HSL and Vibrance Saturation controls. Hence my original question. This helps me learn as well as giving the buzz of helping others. And hopefully also helping Serif, a great British company, to sell more product. With nearly 10,000 subscribers and lots of nice comments, I'm guessing I'm nudging the needle a little.

Slightly perplexingly, Patrick seems to think I am trying to get hold of company secrets and distracting the developers from their important work. Some people would be insulted by this rebuke, but I am not. I was both a developer and then a QA engineer and, if I'm honest, was a pretty prickly geek who sometimes got irritated by perceived challenges. But then I studied psychology, looked in the mirror and hope I'm a bit cooler now. In particular I don't assume I know the thoughts and intent of others. In fact I've found that thinking kindly about them is better for me as well as for my relationships.

So all's good.

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

9 hours ago, dmstraker said:

2. The Vibrance question

A way in Affinity Photo to create a monochrome image is to turn down the saturation. A question is whether this takes account of the 30/59/11% tweak above.

It seems obvious that the Vibrance adjustment does not attempt to tweak colors for equal brightness, perceptually or otherwise. The adjustment appears to be nonlinear, affecting intense highly saturated colors less than less saturated ones. 

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.