From aea2a4ca8d4acc592910ad916b7421b1bdd54354 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 23 Feb 2017 07:59:06 -0800 Subject: [PATCH] legacy getheader mutates the image --- PIL/GifImagePlugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py index 9f9cb9dbc..83dc8f173 100644 --- a/PIL/GifImagePlugin.py +++ b/PIL/GifImagePlugin.py @@ -695,7 +695,9 @@ def getheader(im, palette=None, info=[]): if not "background" in info and "background" in im.info: info["background"] = im.info["background"] - im = _normalize_palette(im, palette, info) + im_mod = _normalize_palette(im, palette, info) + im.palette = im_mod.palette + im.im = im_mod.im header = _get_global_header(im, info) return header, used_palette_colors