mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Simplified code
This commit is contained in:
parent
e7fab6abf4
commit
841ba4a940
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user