Handle palettes with intermittent zeroes

This commit is contained in:
Mike L 2025-04-30 05:12:08 +02:00
parent 4fa6174d1c
commit 32270a18f3
Signed by: mikeslab
GPG key ID: 48CCD1768D862D40
3 changed files with 3 additions and 3 deletions

View file

@ -19,7 +19,7 @@ def readCUR(f, width=-1.0, height=-1.0):
palette = list(frameImage.palette.getdata()[1])
for i in range(4, len(palette), 4):
if sum(palette[i:i + 3]) == 0:
break
continue
palette[i + 3] = 255
frameImage.putpalette(palette, 'BGRA')
frameImage = frameImage.convert('RGBA')

View file

@ -55,7 +55,7 @@ def CURPaletteFix(image):
palette = list(image.palette.getdata()[1])
for i in range(4, len(palette), 4):
if sum(palette[i:i + 3]) == 0:
break
continue
palette[i + 3] = 255
image.putpalette(palette, 'BGRA')

View file

@ -55,7 +55,7 @@ def CURPaletteFix(image):
palette = list(image.palette.getdata()[1])
for i in range(4, len(palette), 4):
if sum(palette[i:i + 3]) == 0:
break
continue
palette[i + 3] = 255
image.putpalette(palette, 'BGRA')