Re: [Gimp-user] 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 <ellestone ninedegreesbelow com>
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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]