Create gif frame delta by subtracting 0x0 image if disposal is mode 2

This commit is contained in:
Riley Lahd 2019-03-08 15:56:31 -07:00
parent 1f6d1be7fc
commit 4a2be2af2d

View File

@ -443,9 +443,11 @@ def _write_multiple_frames(im, fp, palette):
if im_frames: if im_frames:
# delta frame # delta frame
previous = im_frames[-1] previous = im_frames[-1]
if "disposal" in encoderinfo and encoderinfo["disposal"] == 2: if encoderinfo["disposal"] == 2:
# If diposing whole frame, treat full new frame as delta # Entire frame should be delta
delta = im_frame # Create delta by subtracting empty image from frame (This is required)
delta = ImageChops.subtract_modulo(
im_frame, Image.new('P', (0,0)))
elif _get_palette_bytes(im_frame) == \ elif _get_palette_bytes(im_frame) == \
_get_palette_bytes(previous['im']): _get_palette_bytes(previous['im']):
delta = ImageChops.subtract_modulo(im_frame, delta = ImageChops.subtract_modulo(im_frame,