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

Closed
opened 3 years ago by Rawalanche · 20 comments

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

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche
rjg commented 3 years ago
Collaborator

Added subscriber: @rjg

Added subscriber: @rjg
rjg commented 3 years ago
Collaborator

This comment was removed by @rjg

*This comment was removed by @rjg*
rjg commented 3 years ago
Collaborator

This comment was removed by @rjg

*This comment was removed by @rjg*
Poster

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.
rjg commented 3 years ago
Collaborator

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

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.
rjg commented 3 years ago
Collaborator

This comment was removed by @rjg

*This comment was removed by @rjg*
brecht commented 3 years ago
Owner

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

Changed status from 'Needs Triage' to: 'Confirmed'
brecht commented 3 years ago
Owner

Added subscriber: @brecht

Added subscriber: @brecht
brecht commented 3 years ago
Owner

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?
rjg commented 3 years ago
Collaborator

@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.
EAW commented 9 months ago

Added subscriber: @EAW

Added subscriber: @EAW
Collaborator

This issue was referenced by 5baa3ecda6

This issue was referenced by 5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
brecht closed this issue 9 months ago
brecht self-assigned this 9 months ago
Owner

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/Collada
Interest/Compositing
Interest/Core
Interest/Cycles
Interest/Dependency Graph
Interest/Development Management
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/Modeling
Interest/Modifiers
Interest/Motion Tracking
Interest/Nodes & Physics
Interest/Overrides
Interest/Performance
Interest/Performance
Interest/Physics
Interest/Pipeline, Assets & I/O
Interest/Platforms, Builds, Tests & Devices
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
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/Asset Browser (Archived)
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Code Quest
legacy project/Datablocks and Libraries
legacy project/Eevee
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/GPU / Viewport
legacy project/GSoC
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Nodes
legacy project/OpenGL Error
legacy project/Papercut
legacy project/Pose Library Basics
legacy project/Retrospective
legacy project/Tracker Curfew
legacy project/Wintab High Frequency
Meta/Good First Issue
Meta/Papercut
migration/requires-manual-verification
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 & Devices
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 Information 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

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#74610
Loading…
There is no content yet.