Page MenuHome

Saving image from image editor resets Image Texture color space
Confirmed, NormalPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.87

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-02-12 16:20, hash: rB77d23b0bd76f
Worked: (optional)

Short description of error
The bug originally reported here https://developer.blender.org/T74284 which has been irresponsibly ignored has even more dangerous side effects. When using Blender's image editor to edit and save images, each time image is saved, Image Texture node color space is reset.

Exact steps for others to reproduce the error

  1. Create a new image datablock
  2. Edit it using Blender's image editor
  3. Save it as an external image file (JPG)
  4. Load this externally saved image file as an image texture
  5. Set image texture color space to anything else than sRGB (default)

  1. Resave the image from the Image Editor


Result: Color Space of the loaded texture gets reset to sRGB

Expected: Color Space never changes once set up by user.

This issue make it impossible to reliably use any non sRGB image data authored by Blender in Blender.

Event Timeline

This comment was removed by Robert Guetzkow (rjg).

I removed my last comment, because it was incorrect. The image data-block references the file. Therefore the selected color space should match the data stored in the image.

How can you decide color space of the data just based on the image container format? For example PNG image can contain diffuse color map or normal map. Both require reading the PNG different format using different colorspace. There is simply no reliable way to automatically decide what the loaded image file contains just based on the format.

@Ludvik Koutny (rawalanche) You can (and should) set the color space to Non-Color for normal maps. I've tested that this setting isn't changed by saving the image.

@Ludvik Koutny (rawalanche) Setting the color space to Non-Color will accomplish that and I've tested that this setting isn't changed by saving the image.

Why should non-color be one specific settings that behaves differently to others, and why should non-color not change when re-saving loaded file but change when another file is selected as image texture sources? This is a horrible minefield or random, under the hood exceptions.

This comment was removed by Robert Guetzkow (rjg).
Brecht Van Lommel (brecht) changed the task status from Needs Triage to Confirmed.Tue, Mar 10, 2:29 PM
Brecht Van Lommel (brecht) changed the subtype of this task from "Report" to "Bug".

It simply should not change the colorspace in this case. There are some cases where it should (e.g. saving OpenEXR as PNG with view transform applied), but this is not one of them.

@Robert Guetzkow (rjg) Since when are .png sRGB only?
It stores RGB values and how to interpret is not up to the container format as far as i know, no?

@Manuel Grad (manitwo) It seems that you're right, the png format defines iCCP chunks that would allow to use an embedded ICC profile. Although the sRGB chunk is the most common way of storing the data. Sorry for causing any confusion, I'm currently a bit ill and not quite up to speed.