Image "Save As" and changing colorspace: invalid colorspace change #101331
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#101331
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 10
Graphics card: RTX3700
Blender Version
Broken: 3.3.0 Probably caused by
5baa3ecda6
.Worked: 3.1.2
Short description of error
When saving an image, we can change the color space in the save properties.
When we do this, we can see that the
Color Space
for the image has been changed in the image properties, but the image itself has not changed within Blender.Similarly in Python, we can see that this value has been changed (
bpy.data.images- [x].colorspace_settings.name
)Afterwards, setting back the
Color Space
to 'sRGB' makes visual changes to the image and you are unable to get back the original imageThe exported file is different (darker), as if a Linear -> sRGB has been made instead of the requested opposite.
Blender 3.1 does not have the option to change color space when saving the image but according to a few tests, the image is converted to sRGB before saving (ie if you have a linear encoding and save the file, the image is switched to sRGB and the exported file is the same as in blender)
Exact steps for others to reproduce the error
Color Space
toLinear
Save As Image
ColorSpaceBug.blend
Added subscriber: @FlorentM
Image "Save As" and changing colorspace: colorspace is changed without change on the imageto Image "Save As" and changing colorspace: invalid colorspace changeAs an additional comment (I don't know where it belongs), the behavior of python API Image.save() has a breaking change.
Before, the image was automatically converted to sRGB before saving and it's not the case anymore. So probably the function should have an optional parameter where the default behavior is backwards compatible.
(This was my initial issue as I have scripts for automatically baking AO on linear images and then saving them)
Added subscriber: @mano-wii
Changed status from 'Needs Triage' to: 'Confirmed'
Probably caused by
5baa3ecda6
.It looks like there is an unwanted color space conversion.
Not sure if it's a bug or intentional, but it looks like a bug at first glance.
Added subscribers: @brecht, @PratikPB2123
Changed status from 'Confirmed' to: 'Needs User Info'
This is by design. When setting a color space in the save dialog, it means the image will be saved in that colorspace in the file. It's not meant to change how the image looks, it's just specifying how the image is encoded in the file.
This setting is the colorspace of the file on disk. So since it was saved as Linear, for Blender to read it back correctly the setting should specify the image on disk is in Linear color space.
I'm not exactly sure what this refers to, what the state of the image is before saving, but I believe it's an intentional change.
The
image.save()
method should now save the image in whatever colorspace was specified in the image settings, instead of ignoring it and guessing a colorspace.I get that, but the bug is that it DOES change the color space within blender when it shouldn't, try the use case
Before saving
After saving as 'linear'
Note the color space has changed in the image properties but the visual has not changed
When I switch it back to sRGB, the image is altered:
The use case is this: have an image in linear encoding. Use Image.save() as PNG. Before 3.3, the image was converted to sRGB before saving (I don't believe it was ignoring and guessing what it was). And the sRGB encoding stayed in blender. Now it's not converted and using the colorspace in the image settings.
I could not find anything related to the behavior change in blender 3.2 or 3.3 changelogs, either for "save as..." dialog or API function.
The previous API behavior (automatically changing image format to sRGB) was undocumented.
So it's just we had an undocumented behavior that has been changed in an uncommunicated change. It broke my scripts and I hope I'm the only one.
That is the intent. You saved the file in a different color space, so now the colorspace setting is changed to match the colorspace of the file.
The file is not in sRGB colorspace, so indicating that it is will indeed give the wrong result.
Mmmm I'm still puzzled by the behavior change. If you start from a linear image, you do get different results
ColorSpaceBug2.blend
3.3: "Save as " changing to sRGB in the save dialog
vs
3.1: "Save as" - no select box, automatically changes to sRGB
Well, maybe I do not understand well the meaning of this "Color Space" attribute in the image properties
Changing color space does not actually alters the image data buffer, and only the conversion that is applied when it's displayed?
And so, according to https://developer.blender.org/T74610, the behavior in 3.1 was actually a long-standing bug that has been fixed?
I think I understood what Brencht explained and it no longer seems like a bug to me.
Let's consider an image using the
sRGB
color space as an example.If you save this image as being in
Linear
space, it takes the entiresRGB
color transform and converts it toLinear
.Thus, its
Linear
becomes what it used to besRGB
(the interface changes toLinear
for convenience).If you change the space before
Linear
tosRGB
, you are transforming the color of what is already transformed. It's like applyingsRGB
twice.I may have misunderstood however.
On the other question raised (
image.save()
) I suggest doing another report.Changed status from 'Needs User Info' to: 'Archived'
Yes. Saving an image in a different colorspace in the file should not change it visually, that was a bug.
The way to understand it is that Blender works in scene linear color space, and the colorspace settings are about converting to and from that for file I/O and display.
https://docs.blender.org/manual/en/dev/render/color_management.html
There are some caveats in the implementation, in practice conversion may be delayed or cancel out for performance/memory/precision reasons. But the meaning and visual display of the color in Blender remains the same, regardless of the color space, bit depth or compression used in the file on disk.
The Python API change is not a bug either, but should been better documented in the release notes.