From ae194096d064d6dd02d2a0cfa147fa4730d81f57 Mon Sep 17 00:00:00 2001 From: Riley Lahd Date: Fri, 8 Mar 2019 12:48:22 -0700 Subject: [PATCH] Allow correct delta generation for GIFs with disposal 2 (Fixes #3665) --- src/PIL/GifImagePlugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 2ebd8b248..44c32faeb 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -443,7 +443,10 @@ def _write_multiple_frames(im, fp, palette): if im_frames: # delta frame previous = im_frames[-1] - if _get_palette_bytes(im_frame) == \ + if encoderinfo["disposal"] == 2: + # If diposing whole frame, treat full new frame as delta + delta = im_frame + elif _get_palette_bytes(im_frame) == \ _get_palette_bytes(previous['im']): delta = ImageChops.subtract_modulo(im_frame, previous['im'])