From 461628845d3c9ca33bb230603ef5e87aeb4ead50 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 28 Jun 2021 22:12:38 +1000 Subject: [PATCH] Disposal method 2 is transparency or black when saving --- src/PIL/GifImagePlugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 135c9c68f..bb88761e6 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -461,10 +461,10 @@ def _write_multiple_frames(im, fp, palette): previous = im_frames[-1] if encoderinfo.get("disposal") == 2: if background_im is None: - background = _get_background( - im, - im.encoderinfo.get("background", im.info.get("background")), + color = im.encoderinfo.get( + "transparency", im.info.get("transparency", (0, 0, 0)) ) + background = _get_background(im_frame, color) background_im = Image.new("P", im_frame.size, background) background_im.putpalette(im_frames[0]["im"].palette) base_im = background_im