Merge pull request #3086 from radarhere/info

Change encoderinfo to have priority over info when saving GIF images
This commit is contained in:
Hugo 2018-04-11 15:23:19 +03:00 committed by GitHub
commit 215b0e0833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"]