Browse Source

Handle palettes with intermittent zeroes

Mike L 1 month ago
parent
commit
32270a18f3
3 changed files with 3 additions and 3 deletions
  1. 1 1
      ani2cape.py
  2. 1 1
      ani2gif.py
  3. 1 1
      ani2spritesheet.py

+ 1 - 1
ani2cape.py

@@ -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')

+ 1 - 1
ani2gif.py

@@ -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')
 

+ 1 - 1
ani2spritesheet.py

@@ -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')