diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 9cdd987da9f..25f7d9f4037 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -432,10 +432,6 @@ def _normalize_mode(im): It may return the original image, or it may return an image converted to 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 :returns: Image object """ @@ -443,10 +439,7 @@ def _normalize_mode(im): im.load() return im if Image.getmodebase(im.mode) == "RGB": - palette_size = 256 - if im.palette: - palette_size = len(im.palette.getdata()[1]) // 3 - im = im.convert("P", palette=Image.Palette.ADAPTIVE, colors=palette_size) + im = im.convert("P", palette=Image.Palette.ADAPTIVE) if im.palette.mode == "RGBA": for rgba in im.palette.colors.keys(): if rgba[3] == 0: