Don't invert the alpha channel in the Invert Image node

ImageInvert applied 1.0 - image across the whole tensor, so a 4 channel
RGBA image came back with its transparency flipped: opaque pixels became
transparent and vice versa. Alpha stores coverage, not color, so leave it
alone and only invert RGB. Matches GIMP, ImageMagick and Blender, and the
existing srgb_to_linear/hlg_to_linear handling in nodes_images.py.

Reported in #5610.
This commit is contained in:
Glary-Bot
2026-08-14 20:37:26 +00:00
parent b963f4ad21
commit 6eb4f6f4cf
2 changed files with 48 additions and 0 deletions

View File

@@ -1947,6 +1947,8 @@ class ImageInvert:
def invert(self, image):
s = 1.0 - image
if image.shape[-1] == 4: # alpha stores transparency, not color
s[..., 3] = image[..., 3]
return (s,)
class ImageBatch: