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

Curves Adjustment: LAB Mode -> Desaturation Bug


Recommended Posts

OS: Windows 11  AP: 2.4.1

Problem description: When desaturating an image with curves adjustment in LAB mode, the image is not fully desaturated but contains still a little color. That should not be the case, the image should be fully desaturated. Is this a bug? Does the curves adjustment in LAB mode is not correctly calibrated?

Steps to reproduce:

1. Download the images attached (they are taken from https://en.wikipedia.org/wiki/HSL_and_HSV and correspond to Fig.13a and Fig13b)
2. Inspect the original (colored) image and the desaturated image (both from wikipedia). The desaturated version is the the original image in which the AOpponent-/BOpponent values are set to 0.5 (=neutral grey).
3. Reproduce the result in affinity photo by adding a curves adjustment and set mode to LAB. For AOpponent and BOpponent drag the curves such they are horizontal and have constant y-value = 0.5 everywhere.
4. Now compare the result to the downloaded black & white image (all images below). You will see that the reproduced image with curves adjustment still has a cyan tint. To verify this do next step.
5. Add an black & white adjustment and set all hue sliders to 0%. You will notice that only the cyan slider has an effect.
6. Toggle on/off the black & white adjustment and observe that the cyan tint will be removed when the b&w adj is active. When active the result looks like the downloaded b&w image, when b&w adj inactive you will notice the tint.

This can be reproduced with any colored image. As a final step always add the b&w adj and toggle it on/off - you will notice that the b&w adj removes the cyan tint which seems to be left in any image that is desaturated with the curves adj in LAB mode.

Why does it matter? The LAB desaturation method is the one that desaturates in a way such that the perceived lightness is preserved (i.e. for the human eye it looks exactly like the original image just without colors - kind of lightness untouched). The reason is that the LAB color model strictly separates "lightness" from "color" as opposed to HSV and HSL and other color models. But somehow in affinity the implementation does not seem to be accurate.

Fire_breathing_2_Luc_Viatour.jpg

Fire-breather_CIELAB_L .jpg

Fire_breathing_2_Luc_Viatour_Affinity_LAB curve adj.jpg

Link to comment
Share on other sites

4 minutes ago, stevenmiller said:

2. Inspect the original (colored) image and the desaturated version. The desaturated version is the the original image in which the AOpponent-/BOpponent values are set to zero (=neutral grey).
3. Reproduce the result in affinity photo by adding a curves adjustment and set mode to LAB. For AOpponent and BOpponent drag the curves such they are horizontal and have constant y-value = 0.5 everywhere.

0.5 is not zero. What am I missing? :/

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

There are better methods to desaturate an image than using a lab curves adjustment in non-lab documents.

Curves in LAB mode require double conversion, depending on blend mode 4 conversions. Minor issues can stack up.

It starts with the encoding of lab colors in 16 bit integers does not allow to represent 0.5 La Lb values exactly. It is off by 1/2 least significant bit.

 

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

I cannot reproduce any cyan tint when using curves adjustment.

You must use numeric input for the nodes. If using mouse, the numeric values are rounded for UI and you may create the node at a slightly off position.

a better way is channel mixer, and enter 0% La/Lb plus 50% offset. This gives exact values.

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

@NotMyFault Thx for showing this alternative LAB method, but it produces the exact same result - a slight cyan tint.

By the way: I did not literally "drag" the curves, I entered the exact value 0.5 as numeric input - and there is a slight cyan tint, hard to see I admit, but there is.

This cyan tint is independent of the LAB desaturation method and the image used. Look at the two b&w images attached, one of them has a slight tint.

You can only see the tint if you toggle on/off the layer very quickly - however, just looking a the tinted image does not reveal it, without comparing it to the fully desaturated image it's almost not perceivable - but it's there, and I think this is a bug in affinity.

Link to comment
Share on other sites

@stevenmiller If you first CONVERT your file to Lab/16, you can then neutralize the a* and b* channels, which will give you a dead neutral image, where all tones from black to white are fully desaturated. Now you are in Lab color mode and the curves possess their full range, without having to make multiple conversions. I suspect when working on an image in RGB and switching modes with Curves, Levels, etc, you are getting exactly what @NotMyFault reported. I doubt it was designed for desaturating an image.

And as he mentioned, there are much better ways to convert from color to B&W. To preserve tonality, Channel Mixer works quite well. If you want more control over the tones, you can choose a B&W adjustment layer. Or, desaturate with HSL, then adjust tonality as desired with Curves, Levels, etc. 

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

Link to comment
Share on other sites

@Ldina Thx for the suggestion. I forgot to mention that I tried this already: Conversion to Lab/16 does not change the result, still a cyan tint - using different images, using the channel mixer or curves adjustment.

I know that there are other techniques to desaturate an image - that's not what I am trying to get it.

My point is that the desaturation when setting AOpponent and BOppenent to 0.5 (no matter if curves or channel mixer), it does not fully desaturate, there is still an (almost not perceivable) cyan tint left. You can fully get rid of this tint by adding a b&w adj on top of this and setting cyan to 0%, but that's not my point.

Shouldn't you get a fully desaturated image using above methods in the first place? Doesn't this indicate that curves and channel mixer in LAB mode do not work properly?

Link to comment
Share on other sites

@stevenmiller The Lab readouts report 0a* and 0b* values in the Info Panel when flattening the a* and b* curves to 0.5 for both black and white. You are correct that there seems to be a very slight cyan reported in the RGB readouts. I saw that using the RGB samplers in the Info Panel that the red channel is sometimes 1 to 2 points lower than green and blue channels, depending on the density. I can't see it with my eye, but that's what the RGB sampler shows. I didn't download your image because I was nearly done typing this message before you uploaded it, and I saw it in my own version. 

I'm guessing that could be the CMS module they are using, 16 bit Lab vs 8 bit RGB rounding errors (even just for reporting RGB values in the Info Panel). I'm not sure, but if I can't see it, I'm not too worried about it. Besides, if I'm looking for a dead neutral B&W, I'd never use that method to desaturate an image anyway. 

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

Link to comment
Share on other sites

One last thought...

If you convert from sRGB/8 to Lab/16 and choose "gray tone" from the conversion dropdown box (see screenshot), you get dead neutral RGB readouts in the sampler. If that's your intent, that gives you the L* luminosity you desire and 0a*/0b* values across the entire tonal range, without any color cast (whether that's an actual color cast, or just interpolation error).  I presume that is what the gray tone options is designed to do. 

 

Screenshot 2024-04-05 at 8.54.42 PM.png

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

Link to comment
Share on other sites

The issue is that the info panel does not convert LAB to RGB colors "corretcly" and used different rendering intend and or color profiles that used in Document->Convert and Color Panel. You will spot deviating color information in info panel vs. color panal even inside one document of the same color format (except the simplistic case RBB/ sRGB)

As Ldina has shown, every color format conversion has a bunch of parameters (rendering intend) and only when converting a document you can choose the parameter. When using Info panel or color panel, undocumented default rendering intend is used. Another factor to play in is RGB color profile. As far as i remember, Affinity use the profiles defined in assistant for some of the conversions, andmay use undocumented defaults for others.

 

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

1 hour ago, NotMyFault said:

The issue is that the info panel does not convert LAB to RGB colors "corretcly"

Irony alert! :P

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

@Ldina@NotMyFault hmm, a little dissatisfying that Affinity couldn't make it work properly...but I guess if they don't consider this an issue we have to live with that inaccuracy....

Another thing: Does the Windows version of Affinity has less color profiles? You have a whole bunch, I even don't have Grey Tone as a drop down item, only have CIELABD50...

ColorProfiles.png.f880af18362f28331a942f090cad00e5.png

Link to comment
Share on other sites

3 hours ago, NotMyFault said:

As far as i remember, Affinity use the profiles defined in assistant for some of the conversions

I think you're right about what might be happening, but I think those profiles are specified in the Color section of the application Settings/Preferences, not the Assistant.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

@stevenmiller I agree with you that they should make sure color is handled and converted properly, and reported accurately and consistently in all panels. Rounding errors are unavoidable to some extent (even in Photoshop), but they have room for improvement.

not sure about all those extra profiles…not at my computer now.

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

Link to comment
Share on other sites

@stevenmiller I'm at my computer now. Those "additional" profiles (gray tone, blue tone, sepia, etc...when converting to Lab) are on my system, and I do recall that I added them to my Mac Colorsync Library at one point. I don't remember where they originated, (maybe my scanner or a 3rd party app?), but I added them just to make them available in case I needed or wanted them. They were NOT a part of the Affinity installation. So, you couldn't choose them if you wanted!

Sorry for leading you astray...my mistake.

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

Link to comment
Share on other sites

@stevenmiller I'm sure those "extra profiles" are Lab based profiles I installed from a 3rd party app at one time. I've attached a screenshot of the "Gray Tone" profile as displayed in the Mac ColorSync utility. This is an Abstract Lab profile, and also uses a Lab PCS (profile connection space), which is why it shows up in the dropdown when converting to Lab in Affinity, since they ARE Lab based profiles that Affinity (and other color managed apps) can see and use. Probably too much information, but I wanted to clear this up.

I used to do a lot with Lab based profiles, especially when doing B/W and monochrome work with dedicated monochrome and toned ink sets. They might be profiles from QuadToneRIP or IJC/OPM, which both utilize special, non-standard ink sets for smooth, high quality B&W and toned archival prints. I'm not sure, but I did use Lab profiles a lot when doing that sort of work, so one of those programs may be the source. Anyway, sorry for the confusion and dead end. 🥴

Screenshot 2024-04-06 at 10.09.27 AM.png

2017 15" MacBook Pro, 16 MB RAM, Ventura v13.6.6, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish

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.