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

The new "linear" and "gamma" precision choices

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.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

The new "linear" and "gamma" precision choices Elle Stone 07 Jul 21:23
  The new "linear" and "gamma" precision choices Michael Henning 08 Jul 01:29
Elle Stone
2013-07-07 21:23:26 UTC (almost 11 years ago)

The new "linear" and "gamma" precision choices

Gimp from git allows the user to choose which image precision to use while editing the image. The choices used to be 8-bit, 16-bit, and 32-bit integer, plus 16-bit and 32-bit floating point. The choices have recently doubled: for each image precision choice, the user must choose whether to work in a "linear" or a "gamma" color space. The default seems to be "gamma" rather than "linear".

I did some experimenting to see what these new "precision" choices might mean:

The practical result of choosing "linear" vs "gamma" as your image "precision" depends on the image's actual RGB color space TRC (whether linear or true sRGB TRC or some other TRC) and it also depends on which operations you want to perform. Limited testing suggests that at present it affects blend modes but not blurring or gradients.

CASE A: the image is in the regular sRGB color space

If the image is already in the regular sRGB color space, then choosing "gamma" means for example that a soft-light blend of an image over itself will look like it was done in the regular sRGB color space. But choosing "linear" means it will look like the blend was done in a linear gamma version of the sRGB color space and the result will be darker than it would be if done in the regular sRGB color space. In both cases gradients look like regular sRGB gradients. And in both cases, blurring looks like it was done in a linear gamma version of the sRGB color space.

CASE B: the image in a linear gamma version of the sRGB color space

If the image is already in a linear version of the sRGB color space, then choosing "gamma" means that a soft-light blend of an image over itself will look like it was done in a *linear* gamma version of the sRGB color space. And choosing "linear" means it will look like the blend was done in a gamma=0.45 (approx) version of the sRGB color space. In both cases gradients look like linear gamma sRGB gradients. And in both cases blurring looks like it was done in a gamma=0.45 version of the sRGB color space.

CASE C: the image is in some color space other than sRGB

Some color management background:

The "gamma" precision refers to the regular sRGB matrix color space tone response curve. However, the sRGB matrix color space is not a true gamma color space. Its tone response curve (TRC) is composed of a linear section at the toe and a true gamma=2.4 section everywhere else.

A linear gamma version of the sRGB color space is the regular sRGB color space with the regular sRGB TRC replaced with a gamma=1.0 TRC.

RGB matrix working spaces like sRGB or CIE-RGB or a ProPhoto-like color space, etc, are defined primarily by three things: their RGB Primaries, their Tone Response Curve, and their white point. Putting white point aside (lcms takes care of that behind the scenes), a color space's Primaries determine the reddest red, bluest blue, and greenest green that color space can contain. A color space's TRC determines how fast a color goes from dark to light as the RGB values go from 0 to max white (255 for 8-bit integer, 65535 for 16-bit integer, 1.0 for floating point).

So linear sRGB is not the only linear gamma color space. You can have linear gamma versions of any working space. And you can also have, for example, a color space with the CIE-RGB primaries and the regular sRGB tone response curve. ProPhoto-like color spaces usually have a gamma=1.8 TRC but you can create a linear gamma version of a ProPhoto-like color space, and a version with the regular sRGB TRC. And so on.

What happens if your image happens to be in a color space other than the regular sRGB color space?

The Gimp "gamma" and "linear" precision code assumes the image has the regular sRGB TRC. The closer a color space's TRC is to the regular sRGB TRC, the more the resulting tonalities will be like case A above. The closer the color space's TRC is to being linear, the more the result's will be like CASE B above. And results will be more or less wrong to the extent that the color space's TRC deviates from the sRGB TRC.

May I ask what is the point or reason for this new and confusing option of "linear" and "gamma" precision? I say "confusing" because it changes the mathematically expected behavior given the TRC of the image color space.

I should probably confess that for my own image editing I use a version of babl/gegl/Gimp where the babl conversions between linear and regular sRGB are eliminated. That way I can choose which color space I want to work in and be confident of the results: linear gamma working space, linear gamma results; higher gamma working space, higher gamma results. I fear this "out" will not be viable for long.

Elle, as usual, puzzled

Michael Henning
2013-07-08 01:29:09 UTC (almost 11 years ago)

The new "linear" and "gamma" precision choices

Elle: Things are confusing now because the code isn't finished. A lot of things will change before 2.10 is released.

Rest assured, we won't keep everything this way.

On Sun, Jul 7, 2013 at 5:23 PM, Elle Stone wrote:

Gimp from git allows the user to choose which image precision to use while editing the image. The choices used to be 8-bit, 16-bit, and 32-bit integer, plus 16-bit and 32-bit floating point. The choices have recently doubled: for each image precision choice, the user must choose whether to work in a "linear" or a "gamma" color space. The default seems to be "gamma" rather than "linear".

I did some experimenting to see what these new "precision" choices might mean:

The practical result of choosing "linear" vs "gamma" as your image "precision" depends on the image's actual RGB color space TRC (whether linear or true sRGB TRC or some other TRC) and it also depends on which operations you want to perform. Limited testing suggests that at present it affects blend modes but not blurring or gradients.

CASE A: the image is in the regular sRGB color space

If the image is already in the regular sRGB color space, then choosing "gamma" means for example that a soft-light blend of an image over itself will look like it was done in the regular sRGB color space. But choosing "linear" means it will look like the blend was done in a linear gamma version of the sRGB color space and the result will be darker than it would be if done in the regular sRGB color space. In both cases gradients look like regular sRGB gradients. And in both cases, blurring looks like it was done in a linear gamma version of the sRGB color space.

CASE B: the image in a linear gamma version of the sRGB color space

If the image is already in a linear version of the sRGB color space, then choosing "gamma" means that a soft-light blend of an image over itself will look like it was done in a *linear* gamma version of the sRGB color space. And choosing "linear" means it will look like the blend was done in a gamma=0.45 (approx) version of the sRGB color space. In both cases gradients look like linear gamma sRGB gradients. And in both cases blurring looks like it was done in a gamma=0.45 version of the sRGB color space.

CASE C: the image is in some color space other than sRGB

Some color management background:

The "gamma" precision refers to the regular sRGB matrix color space tone response curve. However, the sRGB matrix color space is not a true gamma color space. Its tone response curve (TRC) is composed of a linear section at the toe and a true gamma=2.4 section everywhere else.

A linear gamma version of the sRGB color space is the regular sRGB color space with the regular sRGB TRC replaced with a gamma=1.0 TRC.

RGB matrix working spaces like sRGB or CIE-RGB or a ProPhoto-like color space, etc, are defined primarily by three things: their RGB Primaries, their Tone Response Curve, and their white point. Putting white point aside (lcms takes care of that behind the scenes), a color space's Primaries determine the reddest red, bluest blue, and greenest green that color space can contain. A color space's TRC determines how fast a color goes from dark to light as the RGB values go from 0 to max white (255 for 8-bit integer, 65535 for 16-bit integer, 1.0 for floating point).

So linear sRGB is not the only linear gamma color space. You can have linear gamma versions of any working space. And you can also have, for example, a color space with the CIE-RGB primaries and the regular sRGB tone response curve. ProPhoto-like color spaces usually have a gamma=1.8 TRC but you can create a linear gamma version of a ProPhoto-like color space, and a version with the regular sRGB TRC. And so on.

What happens if your image happens to be in a color space other than the regular sRGB color space?

The Gimp "gamma" and "linear" precision code assumes the image has the regular sRGB TRC. The closer a color space's TRC is to the regular sRGB TRC, the more the resulting tonalities will be like case A above. The closer the color space's TRC is to being linear, the more the result's will be like CASE B above. And results will be more or less wrong to the extent that the color space's TRC deviates from the sRGB TRC.

May I ask what is the point or reason for this new and confusing option of "linear" and "gamma" precision? I say "confusing" because it changes the mathematically expected behavior given the TRC of the image color space.

I should probably confess that for my own image editing I use a version of babl/gegl/Gimp where the babl conversions between linear and regular sRGB are eliminated. That way I can choose which color space I want to work in and be confident of the results: linear gamma working space, linear gamma results; higher gamma working space, higher gamma results. I fear this "out" will not be viable for long.

Elle, as usual, puzzled _______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list