I wrote a Python script to automate my rendering workflow (run from command line with --background).
The problem is that the resulting colors are different from the desired colors that are rendered in the GUI. Python result appears washed-out. Same incorrect result when the script is executed in Blender GUI.
Files are saved as .png. Blender 2.91.2.
Relevant Python code (simplified):
scene.frame_set(0)
bpy.ops.render.render(use_viewport=False, write_still=False)
bpy.data.images["Render Result"].save_render('./example.png')
A similar but not identical result is reached by changing:
- Render Properties -> Color Management -> Display Device -> None
- Render Properties -> Color Management -> Gamma -> 1.2 instead of 1.0
then saving the file and running the script.
It seems that there is a difference between settings in GUI and in Python. I've played a lot with different configuration values inside the Python script prior to rendering but this brought me no closer to the desired result.
This is as far as my competence goes, but I would like to better understand the issue and achieve an identical result in my Python script.
Edit: the rendered model is imported from an .fbx file


saveinstead ofsave_renderwork? (I think you might be going through the color transform twice.) Otherwise you could usewrite_still=Trueafter setting the scene to render to the file you want. – scurest Jan 24 '21 at 21:42bpy.data.images["Render Result"].save()throws Image 'Render Result' does not have any image data. Settingscene.render.filepathand usingwrite_still=Trueinstead ofsave_rendergives the same result. – Marius321967 Jan 24 '21 at 22:34