0

GIMP by default uses sRGB color space. I have created a two simple png textures using GIMP. The textures contain a single RGB color [0, 0, 128]. The first texture has been exported without the "save gamma" option, the second with the "save gamma" option. In my OpenGL application I load the textures using the following parameters:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, img.getWidth(), img.getHeight(), 0, GL_BGR, GL_UNSIGNED_BYTE, img.accessPixels());

As you can see I don't use sRGB as a texture internal format. Then I read a texture this way:

glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

B component contains the same value - 128 for both textures. I expected to get B component which is equal 128 for the texture exported without the "save gamma" option and B component greater than 128 for the texture exported with "save gamma" option due to gamma curve. Are my assumption correct ? Maybe the Gimp doesn't export the textures as I assumed.

Irbis
  • 1,432
  • 1
  • 13
  • 39
  • I'm guessing you've made a faulty assumption: probably Gimp is just literally omitting any consideration of gamma, rather than baking it in? Complete guess, so not posited as an answer. – Tommy Mar 01 '22 at 16:16
  • I think that [Save gamma](https://docs.gimp.org/2.2/en/gimp-images-out.html) doesn't modify an image before export, it just stores gamma value into metadata like [gAMA](http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.gAMA) chunk in PNG file. As in case of ICC profiles - it is up to application how to use this extra information. – gkv311 Mar 01 '22 at 16:49
  • I have read in many places that graphics editors like a GIMP uses sRGB color spaces so I should use for example `GL_SRGB8` as a texture internal format to get an automatic conversion to the linear color space when reading a texture. In the above example I intentionally don't use sRGB as an internal texture format to see whether GIMP exports images in sRGB color space. – Irbis Mar 01 '22 at 19:09
  • Nothing actually changes in the image data if you change the characterisation of the image. Just the way your supposed to interpret the data downstream. Since your interpretation is same in both cases, and your data is same, result is same. The point is a image in sRGB mode is indistinguishable from a image in any other mode, you just need to know that the image is in that mode by reading metadata or trusting a external source. – joojaa Mar 01 '22 at 19:51

1 Answers1

0

When I create a texture in GIMP I choose a color from the sRGB palette. The visible representation of the color [0,0,128] is already defined in sRGB color space. The "save gamma" option only adds metadata info.

Irbis
  • 1,432
  • 1
  • 13
  • 39