Simplified code

This commit is contained in:
Andrew Murray 2022-08-30 08:08:01 +10:00
parent e7fab6abf4
commit 841ba4a940

View File

@ -519,10 +519,7 @@ def _normalize_palette(im, palette, info):
used_palette_colors = [] used_palette_colors = []
for i in range(0, len(source_palette), 3): for i in range(0, len(source_palette), 3):
source_color = tuple(source_palette[i : i + 3]) source_color = tuple(source_palette[i : i + 3])
try: index = im.palette.colors.get(source_color)
index = im.palette.colors[source_color]
except KeyError:
index = None
if index in used_palette_colors: if index in used_palette_colors:
index = None index = None
used_palette_colors.append(index) used_palette_colors.append(index)