From fcaf27d51cfb9f92eb46a1194ae4ad75d1d65d5b Mon Sep 17 00:00:00 2001 From: djy0 Date: Fri, 2 Aug 2019 08:54:04 +0800 Subject: [PATCH] Update GifImagePlugin.py --- src/PIL/GifImagePlugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index bbf6dc9d6..b5323d252 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -472,6 +472,10 @@ def _write_multiple_frames(im, fp, palette): else: bbox = None im_frames.append({"im": im_frame, "bbox": bbox, "encoderinfo": encoderinfo}) + + # see: https://github.com/python-pillow/Pillow/issues/4002 + if len(im_frames) == 1 and 'duration' in im_frames[0]['encoderinfo']: + im.encoderinfo['duration'] = im_frames[0]['encoderinfo']['duration'] if len(im_frames) > 1: for frame_data in im_frames: