RSS/Atom feed Twitter
Site is read-only, email is disabled

Adding LAB support to GIMP

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Adding LAB support to GIMP Elle Stone 30 Nov 11:46
  Adding LAB support to GIMP Alexandre Prokoudine 30 Nov 12:11
   Adding LAB support to GIMP Elle Stone 30 Nov 14:13
Elle Stone
2017-11-30 11:46:05 UTC (over 6 years ago)

Adding LAB support to GIMP

Recently I was asked about LAB support in GIMP 2.9/2.10, and realized that GIMP already has a fair amount of support for editing in the LAB and LCH color spaces. So this email is an attempt to summarize what's already available and then make a list of what would be needed for full support. Comments, corrections, additions, etc are very welcome.

Given other coding priorities and limited developer time, better LAB support to GIMP might not make it into 2.10. But it would be nice to have an idea of what full support for LAB in GIMP might require.

Already it's possible to:

* Decompose to LAB and LCH

* Compose/recompose from LAB and LCH

* Pick colors using LAB and LCH

* Modify colors using the LCH Hue-Chroma tool

* Extract LAB and LCH channels as layers, eg for use as layer masks.

* Manipulate image colors in LAB/LCH using LCH and Luminance blend modes. For example:
Using the Lightness blend mode allows to produce the exact same result as doing Curves, Levels, Brightness, Exposure, etc on the LAB Lightness channel, simply by doing the operation on a copy of a layer, and setting the layer blend mode to LCH Lightness. Often people want to raise and lower Colorfulness (Chroma divided by Lightness) concurrent with changes in tonality. For this, use Luminance blend for the layer with the modified tonality.

It seems to me that full LAB support would require:

* The option to open images that are in the LAB color space, keeping in mind that there are various LAB color space ICC profiles floating around, and some LAB images don't have any embedded ICC profile, but instead just have metadata that indicates the color space. Upon opening a LAB image, it could be immediately converted to RGB for processing, as the conversions from RGB to LAB or LCH for further processing in these color spaces are already handled by babl.

* The option to convert an image to LAB, including to a specific LAB profile from disk, just before exporting the image to disk in whatever file formats there are that support the LAB color space.

* The ability to do Curves and Levels operations on the LAB channels and perhaps on the CH channels. Having LAB/LCH Curves would allow, for example, to raise and lower specific points in the L/A/B/C/H channels without moving the endpoints of the Curves. Such edits are often used for color correction using the A and B channels. As far as I know, nobody offers C and H Curves/Levels, but it would be interesting to see what uses people might come up with.

* Adding L/A/B/C/H histograms to the Histograms dialog: We already have Luminance in the histograms dialog. Lightness is just the perceptually uniform transform of Luminance.

What else might be required to add full support for the LAB space to GIMP?

These two bug reports are about adding support for editing in the LAB color space:

Add LAB color mode: https://bugzilla.gnome.org/show_bug.cgi?id=309485

support other colorspaces in the Curves tool: https://bugzilla.gnome.org/show_bug.cgi?id=432933

These two bug reports are about fixing a couple of bugs in current LAB/LCH functionality:

Decomposed to LAB images have the wrong ICC profile assigned: https://bugzilla.gnome.org/show_bug.cgi?id=765178

"Extracted L" from "Tools/GEGL Operation/Extract Component/Component LAB L" isn't really "L":
https://bugzilla.gnome.org/show_bug.cgi?id=755376

Best, Elle

Alexandre Prokoudine
2017-11-30 12:11:41 UTC (over 6 years ago)

Adding LAB support to GIMP

On Thu, Nov 30, 2017 at 2:44 PM Elle Stone wrote:

It seems to me that full LAB support would require:

* The option to open images that are in the LAB color space, keeping in mind that there are various LAB color space ICC profiles floating around, and some LAB images don't have any embedded ICC profile, but instead just have metadata that indicates the color space. Upon opening a LAB image, it could be immediately converted to RGB for processing, as the conversions from RGB to LAB or LCH for further processing in these color spaces are already handled by babl.

So you are not in the scene referred / display referred camp now? :)

* The ability to do Curves and Levels operations on the LAB channels and perhaps on the CH channels.

We briefly discussed this on #gimp a while ago, it's seems to be doable presently already (but is likely to be somewhat slow).

* Adding L/A/B/C/H histograms to the Histograms dialog: We already have

Luminance in the histograms dialog. Lightness is just the perceptually uniform transform of Luminance.

https://gui.gimp.org/index.php?title=Work_in_progress_on_histogram_redesign

Admittedly, I got sidetracked from this.

What else might be required to add full support for the LAB space to GIMP?

There's probably a place for LAB/LCH-specific tools, like some iops in darktable (e.g. color contrast, CLUT, and especially color zones).

Personally, I'm also a big fan of conditional blending (as available in both darktable and e.g. Photoshop). In darktable, it operates on LAB channels:

http://www.darktable.org/2012/03/upcoming-features-conditional-blending/ http://www.darktable.org/2012/07/some-enhancements-to-conditional-blending/

In Photoshop, it appears to work on whatever channels as per current color mode:

https://digital-photography-school.com/photoshop-tips-blend-if-feature/

Alex

Elle Stone
2017-11-30 14:13:23 UTC (over 6 years ago)

Adding LAB support to GIMP

On 11/30/2017 07:11 AM, Alexandre Prokoudine wrote:

On Thu, Nov 30, 2017 at 2:44 PM Elle Stone wrote:

It seems to me that full LAB support would require:

* The option to open images that are in the LAB color space, keeping in mind that there are various LAB color space ICC profiles floating around, and some LAB images don't have any embedded ICC profile, but instead just have metadata that indicates the color space. Upon opening a LAB image, it could be immediately converted to RGB for processing, as the conversions from RGB to LAB or LCH for further processing in these color spaces are already handled by babl.

Hi Alex, and thanks much! for responding.

So you are not in the scene referred / display referred camp now? :)

After some reflection, I realized that I don't understand the question :)

* Scene-referred editing needs to be done using linear RGB.

* To avoid gamma artifacts, many color mixing/modifying operations need to be done using linear RGB.

* Color mixing/modifying covers a lot more territory in painting and photography than the specific operations that preserve the scene-referred nature of scene-referred output from the camera ("as scene-referred as possible" given the limitations of the camera, the lens, the raw file, and the interpolation algorithms).

* For my own photography workflow I start with an image that's "as scene-referred as possible". But usually that's not the final image but rather the starting point for further editing. I use GIMP's LCH blend modes and tools a lot, for selecting colors and for modifying colors, in paintings and in photographs.

As far as adjusting colors in the LAB color space, and specifically using the A and B channels, the people who've asked me about adding better LAB support to GIMP are people who make their living editing images. It would be odd to tell someone who finds this type of operation useful "Well, that's not a scene-referred operation and it doesn't work on linear RGB, so GIMP shouldn't include it".

* The ability to do Curves and Levels operations on the LAB channels and perhaps on the CH channels.

We briefly discussed this on #gimp a while ago, it's seems to be doable presently already (but is likely to be somewhat slow).

Given the intensity with which people request LAB curves, they might be very happy with "slow" if the other alternative is "not even available".

* Adding L/A/B/C/H histograms to the Histograms dialog: We already have

Luminance in the histograms dialog. Lightness is just the perceptually uniform transform of Luminance.

https://gui.gimp.org/index.php?title=Work_in_progress_on_histogram_redesign

That's a nice write-up!

Regarding "does an a* and b* histogram actually make sense?", this article showing a sample use case for the LAB A and B histograms: https://digital-photography-school.com/how-to-use-lab-color-in-photoshop-to-add-punch-to-your-images/

The actual modification in the article was done using Levels, but seeing the histogram is required to make the adjustments, and does convey information all by itself regarding color distribution.

I have some old PSD files for which digiKam can't display a thumbnail, so I used GIMP to create sidecar "png" files for each of these PSD files - I was surprised at the fairly large percentage of these old PSD files that were in the LAB color space, which GIMP couldn't open, so I don't have any idea what kind of LAB adjustments I might have been making.

Admittedly, I got sidetracked from this.

What else might be required to add full support for the LAB space to GIMP?

There's probably a place for LAB/LCH-specific tools, like some iops in darktable (e.g. color contrast, CLUT, and especially color zones).

Quite awhile back you suggested adding a certain darktable module to GIMP, and I said something like "personally I'd never use that". Several months later I was processing an image to make a black and white rendition and wishing very much that GIMP had that darktable module :)

Except now I can't seem to find the module even in darktable, so maybe I'm not remembering correctly what it was. I wanted the ability to selectively depress the Lightness of all colors within a given range of LCH Hues, trying to somewhat emulate what an actual red or yellow or etc filter would do when shooting black and white film.

Personally, I'm also a big fan of conditional blending (as available in both darktable and e.g. Photoshop). In darktable, it operates on LAB channels:

Conditional blending would be wonderful. I used to use it in Corel's PhotoPaint, and then in PhotoShop - wonderfully easy way to fade out an adjustment towards the shadows and highlights for example, and to limit an adjustment to a given portion of a given channel's histogram.

http://www.darktable.org/2012/03/upcoming-features-conditional-blending/ http://www.darktable.org/2012/07/some-enhancements-to-conditional-blending/

In Photoshop, it appears to work on whatever channels as per current color mode:

https://digital-photography-school.com/photoshop-tips-blend-if-feature/

Alex

Elle