Changed encoderinfo to have priority over info when saving GIF images

This commit is contained in:
Andrew Murray 2018-04-11 08:57:31 +10:00
parent e24fad40ad
commit 05c78a13e7
2 changed files with 7 additions and 3 deletions

View File

@ -305,9 +305,12 @@ class TestFileGif(PillowTestCase):
out = self.tempfile('temp.gif')
im = Image.new('L', (100, 100), '#000')
im.save(out, duration=duration)
reread = Image.open(out)
# Check that the argument has priority over the info settings
im.info['duration'] = 100
im.save(out, duration=duration)
reread = Image.open(out)
self.assertEqual(reread.info['duration'], duration)
def test_multiple_duration(self):

View File

@ -457,7 +457,8 @@ def _save_all(im, fp, filename):
def _save(im, fp, filename, save_all=False):
im.encoderinfo.update(im.info)
for k, v in im.info.items():
im.encoderinfo.setdefault(k, v)
# header
try:
palette = im.encoderinfo["palette"]