Does anybody knows what operation Blender does when it saves the image to .png file?
I am interested in an exact formula, it might be also the source code. What I found in source till now is RGB->sRGB conversion code but for viewport not final rendering.
I am interesting in the subject since I wanted to render images in exr and then convert them to PNG using python script. After conversion by hand i have slight different results then Blender provides natively. I wonder where this difference come from. I need to be precise since I am going to use this data as training for neural networks so I have to be precise as possible and eliminate all possible problems beforehand.
This is the code I use for conversion in python:
def RGB2sRGB2(RGBArray): new_rgb = RGBArray higher = (new_rgb > 0.0031308) lower = (new_rgb <= 0.0031308) new_rgb[higher] = (pow(new_rgb[higher], (1.0 / 2.4))) * 1.055 - 0.055 new_rgb[lower] = 12.92 * new_rgb[lower] return new_rgb Here I post my images (native blender .png file; conversion from .exr; difference map - each blue pixel means that difference is equal 1 in range 0-255):


