Resolved UNDONE by removing code

This commit is contained in:
Andrew Murray 2022-03-12 15:54:08 +11:00
parent 4e16a9a942
commit 76871795f7

View File

@ -432,10 +432,6 @@ def _normalize_mode(im):
It may return the original image, or it may return an image converted to It may return the original image, or it may return an image converted to
palette or 'L' mode. palette or 'L' mode.
UNDONE: What is the point of mucking with the initial call palette, for
an image that shouldn't have a palette, or it would be a mode 'P' and
get returned in the RAWMODE clause.
:param im: Image object :param im: Image object
:returns: Image object :returns: Image object
""" """
@ -443,10 +439,7 @@ def _normalize_mode(im):
im.load() im.load()
return im return im
if Image.getmodebase(im.mode) == "RGB": if Image.getmodebase(im.mode) == "RGB":
palette_size = 256 im = im.convert("P", palette=Image.Palette.ADAPTIVE)
if im.palette:
palette_size = len(im.palette.getdata()[1]) // 3
im = im.convert("P", palette=Image.Palette.ADAPTIVE, colors=palette_size)
if im.palette.mode == "RGBA": if im.palette.mode == "RGBA":
for rgba in im.palette.colors.keys(): for rgba in im.palette.colors.keys():
if rgba[3] == 0: if rgba[3] == 0: