Should I not use Blender's nodes to edit textures?

I was experimenting with heightmap and I discovered that Blender cannot invert the image file in a way that is absolutely negative version of the original image. So I started reading and found out that Blender has a linear color space that makes this difference. If I invert the image with Photoshop, I get very much different version of the image.

First, the image inverted with Blender. The original image is also visible in Blender picture

And the Photoshop version.

Now, when I save the file in Blender to PNG and then open it again in Blender without progression and try to invert it to the original, I get (slightly) different version of the image (Only small difference visible). However I don’t know if it’s because of blender’s PNG exporter, but still there is some difference. In Photoshop I can do this operation without any difference between the files.

In the center there is the original PNG heightmap that can be downloaded from this link: .

Left is the photoshop version of inverted and saved PNG heightmap. Right there is the map inverted in Blender and saved to PNG.

Of course I cannot use the heightmap that is inverted in Blender, because the result is just wrong. I can indeed invert it in displace modifier and get correct displacement, but if I need for some reason the corrected version of the height map, I don’t know how to get it with Blender.

This is expected as Photoshop on its default settings works with gamma-corrected values and Blender works with linearized values.

Sounds like some kind of mismatch in transfer function that converts gamma-corrected values to linear and vice-versa. Or some quirks in png exporter itself.

How are you reading the png file in? As non-color data? The probable reason why the map inverted in Blender does not work is that in compositor you did not read it as non-color data and so the values are transformed because of linearization. And when they are inverted you will not get the result you expect. Set your png Color Space to Non-Color and try inverting it then.

In my tests I loaded the texture as normal image file to compositor. But I don’t even know how to load image as non color data to compositor, there is not that option available in the node just like in cycles there is.

Do you need to be able to see the displacement in the viewport? Or is seeing it in the render “enough”?
If it is the latter, you can always use “true” Cycles displacement and invert the texture with the shader nodes:

Select the image texture node and in the properties panel (shortcut N) change Color Space to Non-Color. In Cycles shader you can set it directly in node parameters (see IkariShinjis image).

I need to be able to save the image as inverse png in Blender.