Saving image from image editor resets Image Texture color space #74610

Closed
opened 2020-03-10 10:03:03 +01:00 by Ludvik Koutny · 20 comments
Contributor

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: 77d23b0bd7
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)
    image.png
  6. Resave the image from the Image Editor
    image.png
    Result: Color Space of the loaded texture gets reset to sRGB
    image.png
    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.

**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: `77d23b0bd7` 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) ![image.png](https://archive.blender.org/developer/F8398719/image.png) 6. Resave the image from the Image Editor ![image.png](https://archive.blender.org/developer/F8398721/image.png) Result: Color Space of the loaded texture gets reset to sRGB ![image.png](https://archive.blender.org/developer/F8398724/image.png) 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.
Author
Contributor

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche

Added subscriber: @rjg

Added subscriber: @rjg

This comment was removed by @rjg

*This comment was removed by @rjg*

This comment was removed by @rjg

*This comment was removed by @rjg*
Author
Contributor

In #74610#888414, @rjg wrote:
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.

> In #74610#888414, @rjg wrote: > 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.

@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.

@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.
Author
Contributor

In #74610#888448, @rjg wrote:
@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.

> In #74610#888448, @rjg wrote: > @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 @rjg

*This comment was removed by @rjg*

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @brecht

Added subscriber: @brecht

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.

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.

Added subscriber: @ManuelGrad

Added subscriber: @ManuelGrad

@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?

@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?

@ManuelGrad 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.

@ManuelGrad 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.

Added subscriber: @fatboyzzfatboyzz

Added subscriber: @fatboyzzfatboyzz

I confirm this bug in blender 3.1.2.
Happens when saving baked texture.

Saving .png file with texture node 'Color Space' set to 'Linear'.
Result in changing the 'Linear' automaticlly to 'sRGB'.
Color looks correct in 'sRGB' but wrong when change back to 'Linear'.

Saving .exr file won't change 'Color Space' automaticlly and everything works fine.
The result color of '.png + srgb' is same as '.exr + linear'.

Seems no way to save linear texture to .png.

Also note this bug happens after texture bake.
I tested by using same source texture then bake to both .png and .exr.
If you simply open a .png set to 'Linear' then save, blender won't change 'Color Space' automaticlly.

I confirm this bug in blender 3.1.2. Happens when saving baked texture. Saving .png file with texture node 'Color Space' set to 'Linear'. Result in changing the 'Linear' automaticlly to 'sRGB'. Color looks correct in 'sRGB' but wrong when change back to 'Linear'. Saving .exr file won't change 'Color Space' automaticlly and everything works fine. The result color of '.png + srgb' is same as '.exr + linear'. Seems no way to save linear texture to .png. Also note this bug happens after texture bake. I tested by using same source texture then bake to both .png and .exr. If you simply open a .png set to 'Linear' then save, blender won't change 'Color Space' automaticlly.
Member

Added subscriber: @EAW

Added subscriber: @EAW

This issue was referenced by 5baa3ecda6

This issue was referenced by 5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2022-05-13 17:56:45 +02:00

This will be fixed in 3.3, since it involves a deeper change that is too risky for 3.2.

This will be fixed in 3.3, since it involves a deeper change that is too risky for 3.2.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#74610
No description provided.