mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	Merge pull request #1273 from radarhere/gif
Added background saving to GifImagePlugin
This commit is contained in:
		
						commit
						200ae2adb3
					
				|  | @ -537,7 +537,8 @@ def getheader(im, palette=None, info=None): | ||||||
|     # size of global color table + global color table flag |     # size of global color table + global color table flag | ||||||
|     header.append(o8(color_table_size + 128)) |     header.append(o8(color_table_size + 128)) | ||||||
|     # background + reserved/aspect |     # 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 |     # end of Logical Screen Descriptor | ||||||
| 
 | 
 | ||||||
|     # add the missing amount of bytes |     # add the missing amount of bytes | ||||||
|  |  | ||||||
|  | @ -201,6 +201,15 @@ class TestFileGif(PillowTestCase): | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(reread.info['loop'], number_of_loops) |         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__': | if __name__ == '__main__': | ||||||
|     unittest.main() |     unittest.main() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user