diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py index 2e519c7ac..34114d438 100644 --- a/PIL/GifImagePlugin.py +++ b/PIL/GifImagePlugin.py @@ -365,6 +365,7 @@ def _save(im, fp, filename, save_all=False): # e.g. getdata(im_frame, duration=1000) if not previous: # global header + previous = im_frame.copy() first_frame = getheader(im_frame, palette, encoderinfo)[0] first_frame += getdata(im_frame, (0, 0), **encoderinfo) else: @@ -386,7 +387,7 @@ def _save(im, fp, filename, save_all=False): else: # FIXME: what should we do in this case? pass - previous = im_frame + previous = im_frame if first_frame: save_all = False if not save_all: diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index d987f6851..dea758506 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -406,10 +406,10 @@ class TestFileGif(PillowTestCase): def test_transparent_optimize(self): # from issue #2195, if the transparent color is incorrectly - # optimized out, gif loses transparency Need a palette that - # isn't using the 0 color, and one that's > 128 items where - # the transparent color is actually the top palette entry to - # trigger the bug. + # optimized out, gif loses transparency + # Need a palette that isn't using the 0 color, and one + # that's > 128 items where the transparent color is actually + # the top palette entry to trigger the bug. from PIL import ImagePalette @@ -425,7 +425,17 @@ class TestFileGif(PillowTestCase): reloaded = Image.open(out) self.assertEqual(reloaded.info['transparency'], 253) - + + def test_bbox(self): + out = self.tempfile('temp.gif') + + im = Image.new('RGB', (100,100), '#fff') + ims = [Image.new("RGB", (100,100), '#000')] + im.save(out, save_all=True, append_images=ims) + + reread = Image.open(out) + self.assertEqual(reread.n_frames, 2) + if __name__ == '__main__': unittest.main()