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

Luminance and luma for an sRGB image using GIMP 2.9

This discussion is connected to the gimp-user-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.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Luminance and luma for an sRGB image using GIMP 2.9 Elle Stone 07 Sep 14:18
  Luminance and luma for an sRGB image using GIMP 2.9 Pat David 07 Sep 15:20
   Luminance and luma for an sRGB image using GIMP 2.9 Elle Stone 07 Sep 15:42
    Luminance and luma for an sRGB image using GIMP 2.9 Elle Stone 07 Sep 17:52
     Luminance and luma for an sRGB image using GIMP 2.9 Elle Stone 08 Sep 13:59
Elle Stone
2015-09-07 14:18:19 UTC (over 8 years ago)

Luminance and luma for an sRGB image using GIMP 2.9

In response to a question that was sent to me by a GIMP 2.9 user, I wrote up instructions on how to use GIMP 2.9 to convert from color to black and white to get "relative luminance" ("luminance" for short).

I'm posting the instructions here because converting from color to luminance is often very useful when editing an image, and right now using GIMP 2.9 to get luminance for an sRGB color image requires using a somewhat complicated and nonobvious series of steps.

In a color-managed image editor like GIMP, the luminance of an sRGB color is calculated using this formula: Luminance = R*0.222 + G*717 + B*0.061, where R, G, and B refer to a pixel's RGB channel values. The "catch" is that you have to operate on linearized RGB. Otherwise you get "luma" instead of luminance.

GIMP 2.9 is a development version of GIMP, and so these instructions might not be valid for very long. But as of September 7th, 2015, here are 7 ways to use GIMP 2.9 to get luminance for a regular sRGB image, plus 3 ways to get luma:

7 ways to get luminance for an sRGB image

1. Assign the GIMP built-in sRGB profile, even if the image already has an embedded sRGB profile. Then convert to 32-bit floating point *linear* precision, and use Colors/Desaturate/Luminosity, and make sure you *DO* check the gamma hack.

2. Or instead of assigning the GIMP built-in sRGB profile, if there is an embedded sRGB profile in your image, first convert to 32-bit floating point *gamma* precision, then convert from the embedded sRGB profile to GIMP's built-in sRGB profile, and then convert to 32-bit *linear* precision, and then use Colors/Desaturate/Luminosity, and make sure you *DO* check the gamma hack.

3. Or if your image has an embedded sRGB profile, stay at 32-bit floating point *gamma* precision, and convert your image from the embedded regular sRGB color space to a linear gamma version of the sRGB color space, using a linear gamma sRGB profile from disk. Then use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

4. Or else stay at 32-bit floating point *gamma* precision and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DON'T* use the gamma hack. Using this method, if your image already has an embedded sRGB profile, you don't have to assign or convert to the GIMP built-in sRGB profile.

5. Or stay at 32-bit floating point *gamma* precision, convert your image to a linear gamma sRGB profile from disk, and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DO* use the gamma hack.

Or if you want to produce a true grayscale (single channel) image:

6. Assign or convert to the GIMP built-in sRGB profile, then convert to grayscale using "Image/mode/convert to grayscale", and you have automatically get relative luminance. It doesn't matter whether you use linear or gamma precision. Both give the same result.

7. Or if your image has an embedded regular sRGB profile, stay at *gamma* precision (because currently linear precision doesn't work with images with embedded ICC profiles), and use "Image/mode/convert to grayscale".

3 ways to get luma for an sRGB image:

1. Assign the GIMP built-in sRGB profile, even if the image already has an embedded sRGB profile. Then convert to 32-bit floating point gamma OR linear precision (it doesn't matter which), and use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

2. Or if you don't want to assign or convert to the GIMP built-in sRGB profile, and instead prefer to use an sRGB profile that's already embedded in the image (or if you have assigned an sRGB profile from disk), then convert to 32-bit floating point *gamma* precision (*don't* select linear precision), and then use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

3. Or stay at 32-bit floating point *gamma* precision and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DO* use the gamma hack. As long as you are at gamma precision, it doesn't matter whether you use GIMP's internal sRGB profile or a regular sRGB profile from disk (but of course don't convert the image to a linear gamma sRGB profile from disk), either way checking the gamma hack will produce luma instead of luminance.

Well, hopefully I didn't make any mistakes writing these instructions up.

Best, Elle Stone

http://ninedegreesbelow.com
Color management and free/libre photography
Pat David
2015-09-07 15:20:56 UTC (over 8 years ago)

Luminance and luma for an sRGB image using GIMP 2.9

Hi Elle!

Did you happen to have some visual examples that demonstrate the differences between the operations (luma vs luminance for instance) for a user to see why they might want one over the other? On Mon, Sep 7, 2015 at 9:24 AM Elle Stone wrote:

In response to a question that was sent to me by a GIMP 2.9 user, I wrote up instructions on how to use GIMP 2.9 to convert from color to black and white to get "relative luminance" ("luminance" for short).

I'm posting the instructions here because converting from color to luminance is often very useful when editing an image, and right now using GIMP 2.9 to get luminance for an sRGB color image requires using a somewhat complicated and nonobvious series of steps.

In a color-managed image editor like GIMP, the luminance of an sRGB color is calculated using this formula: Luminance = R*0.222 + G*717 + B*0.061, where R, G, and B refer to a pixel's RGB channel values. The "catch" is that you have to operate on linearized RGB. Otherwise you get "luma" instead of luminance.

GIMP 2.9 is a development version of GIMP, and so these instructions might not be valid for very long. But as of September 7th, 2015, here are 7 ways to use GIMP 2.9 to get luminance for a regular sRGB image, plus 3 ways to get luma:

7 ways to get luminance for an sRGB image

1. Assign the GIMP built-in sRGB profile, even if the image already has an embedded sRGB profile. Then convert to 32-bit floating point *linear* precision, and use Colors/Desaturate/Luminosity, and make sure you *DO* check the gamma hack.

2. Or instead of assigning the GIMP built-in sRGB profile, if there is an embedded sRGB profile in your image, first convert to 32-bit floating point *gamma* precision, then convert from the embedded sRGB profile to GIMP's built-in sRGB profile, and then convert to 32-bit *linear* precision, and then use Colors/Desaturate/Luminosity, and make sure you *DO* check the gamma hack.

3. Or if your image has an embedded sRGB profile, stay at 32-bit floating point *gamma* precision, and convert your image from the embedded regular sRGB color space to a linear gamma version of the sRGB color space, using a linear gamma sRGB profile from disk. Then use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

4. Or else stay at 32-bit floating point *gamma* precision and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DON'T* use the gamma hack. Using this method, if your image already has an embedded sRGB profile, you don't have to assign or convert to the GIMP built-in sRGB profile.

5. Or stay at 32-bit floating point *gamma* precision, convert your image to a linear gamma sRGB profile from disk, and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DO* use the gamma hack.

Or if you want to produce a true grayscale (single channel) image:

6. Assign or convert to the GIMP built-in sRGB profile, then convert to grayscale using "Image/mode/convert to grayscale", and you have automatically get relative luminance. It doesn't matter whether you use linear or gamma precision. Both give the same result.

7. Or if your image has an embedded regular sRGB profile, stay at *gamma* precision (because currently linear precision doesn't work with images with embedded ICC profiles), and use "Image/mode/convert to grayscale".

3 ways to get luma for an sRGB image:

1. Assign the GIMP built-in sRGB profile, even if the image already has an embedded sRGB profile. Then convert to 32-bit floating point gamma OR linear precision (it doesn't matter which), and use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

2. Or if you don't want to assign or convert to the GIMP built-in sRGB profile, and instead prefer to use an sRGB profile that's already embedded in the image (or if you have assigned an sRGB profile from disk), then convert to 32-bit floating point *gamma* precision (*don't* select linear precision), and then use Colors/Desaturate/Luminosity, and make sure you *DON'T* check the gamma hack.

3. Or stay at 32-bit floating point *gamma* precision and use Colors/Desaturate (the second Desaturate)/Mono mixer, with channel values Red: 0.222 / Green: 0.717 / Blue: 0.061, and *DO* use the gamma hack. As long as you are at gamma precision, it doesn't matter whether you use GIMP's internal sRGB profile or a regular sRGB profile from disk (but of course don't convert the image to a linear gamma sRGB profile from disk), either way checking the gamma hack will produce luma instead of luminance.

Well, hopefully I didn't make any mistakes writing these instructions up.

Best, Elle Stone
--
http://ninedegreesbelow.com
Color management and free/libre photography _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list

Elle Stone
2015-09-07 15:42:05 UTC (over 8 years ago)

Luminance and luma for an sRGB image using GIMP 2.9

On 09/07/2015 11:20 AM, Pat David wrote:

Did you happen to have some visual examples that demonstrate the differences between the operations (luma vs luminance for instance) for a user to see why they might want one over the other?

I'm putting together some visual examples. I'll try to get a link posted today.

Elle Stone
2015-09-07 17:52:30 UTC (over 8 years ago)

Luminance and luma for an sRGB image using GIMP 2.9

On 09/07/2015 11:42 AM, Elle Stone wrote:

On 09/07/2015 11:20 AM, Pat David wrote:

Did you happen to have some visual examples that demonstrate the differences between the operations (luma vs luminance for instance) for a user to see why they might want one over the other?

Here are two examples comparing luminance and luma conversions to black and white:
http://ninedegreesbelow.com/photography/luminance-luma-color-to-black-white.html

Elle Stone
2015-09-08 13:59:08 UTC (over 8 years ago)

Luminance and luma for an sRGB image using GIMP 2.9

On 09/07/2015 01:52 PM, Elle Stone wrote:

Here are two examples comparing luminance and luma conversions to black and white:
http://ninedegreesbelow.com/photography/luminance-luma-color-to-black-white.html

Here is why it matters how to get "luminance" vs "luma" for an sRGB image when using GIMP 2.9:

* "Luminance" is what you get when making a "luminosity" conversion to black and white while operating on linear gamma RGB.

* Luminance conversions to black and white produce a more faithful rendition of the tonality of the original color image color image. This is just one of many artistic advantages to editing in linear gamma color spaces (or in GIMP 2.9, operating on linearized RGB).

* Sometimes converting to luminance or luma is just one step in a more complicated series of editing steps. Whether you start with luminance or luma makes a difference in the final image. And many times you might well prefer the result of operating on linear RGB for all steps in the procedure.

* The procedure for getting luminance or luma in GIMP 2.9 is very different than the procedure for getting luminance or luma in other image editors. For example, here's one to get "luminance" vs "luma" for Krita:

* To get luma using Krita, open a regular sRGB image and use Filter/Adjust/Desaturate/Desaturation method, and pick Luminosity (ITU-R BT.709).

* To get luminance using Krita, open a regular sRGB image and convert it to a linear gamma sRGB profile from disk, using 16-bit floating point or higher precision, and then use Filter/Adjust/Desaturate/Desaturation method, and pick Luminosity (ITU-R BT.709).

And here's one way to get "luminance" vs "luma" for showFoto:

* To get luma using showFoto, open a regular sRGB image and use Color/Channel Mixer, click the Monochrome button, and dial in 22.2/71.7/6.1 (same settings as for GIMP's monochrome, but multiplied by 100).

* To get luminance using showFoto, open a regular sRGB image, convert it to 16-bit integer precision, and then convert it to a linear gamma sRGB profile from disk. Then use Color/Channel Mixer, click the Monochrome button, and dial in 22.2/71.7/6.1 (the same settings as for GIMP's monochrome operation, but multiplied by 100).

Notice that in Krita and showFoto, when you want to switch between luminance and luma you have to make an actual ICC profile conversion.

For most RGB operations, GIMP 2.9 currently allows the user to choose between operating on linearized vs perceptually uniform RGB, without making an ICC profile conversion, which could be a very nice capability. But the user interface for doing is complicated.

Best, Elle