mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Added background color index saving to GifImagePlugin
This commit is contained in:
parent
67c75061d2
commit
ecb1cef99b
|
@ -537,7 +537,8 @@ def getheader(im, palette=None, info=None):
|
|||
# size of global color table + global color table flag
|
||||
header.append(o8(color_table_size + 128))
|
||||
# background + reserved/aspect
|
||||
header.append(o8(0) + o8(0))
|
||||
background = im.info["background"] if "background" in im.info else 0
|
||||
header.append(o8(background) + o8(0))
|
||||
# end of Logical Screen Descriptor
|
||||
|
||||
# add the missing amount of bytes
|
||||
|
|
|
@ -201,6 +201,15 @@ class TestFileGif(PillowTestCase):
|
|||
|
||||
self.assertEqual(reread.info['loop'], number_of_loops)
|
||||
|
||||
def test_background(self):
|
||||
out = self.tempfile('temp.gif')
|
||||
im = Image.new('L', (100, 100), '#000')
|
||||
im.info['background'] = 1
|
||||
im.save(out)
|
||||
reread = Image.open(out)
|
||||
|
||||
self.assertEqual(reread.info['background'], im.info['background'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user