From cc7e023a4ad64c8bae864d76b42e1be0606833af Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Wed, 9 Apr 2025 21:07:07 +0800 Subject: [PATCH] handle palette mode in loadimage node (#7539) --- nodes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nodes.py b/nodes.py index 55d832df9..25fed4258 100644 --- a/nodes.py +++ b/nodes.py @@ -1692,6 +1692,9 @@ class LoadImage: if 'A' in i.getbands(): mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0 mask = 1. - torch.from_numpy(mask) + elif i.mode == 'P' and 'transparency' in i.info: + mask = np.array(i.convert('RGBA').getchannel('A')).astype(np.float32) / 255.0 + mask = 1. - torch.from_numpy(mask) else: mask = torch.zeros((64,64), dtype=torch.float32, device="cpu") output_images.append(image)