mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	Ensure image is loaded in remap_palette
This commit is contained in:
		
							parent
							
								
									804183c248
								
							
						
					
					
						commit
						6db0e96102
					
				|  | @ -582,6 +582,10 @@ class TestImage: | |||
|         assert ext_individual == ext_multiple | ||||
| 
 | ||||
|     def test_remap_palette(self): | ||||
|         # Test identity transform | ||||
|         with Image.open("Tests/images/hopper.gif") as im: | ||||
|             assert_image_equal(im, im.remap_palette(list(range(256)))) | ||||
| 
 | ||||
|         # Test illegal image mode | ||||
|         with hopper() as im: | ||||
|             with pytest.raises(ValueError): | ||||
|  |  | |||
|  | @ -1796,6 +1796,7 @@ class Image: | |||
| 
 | ||||
|         if source_palette is None: | ||||
|             if self.mode == "P": | ||||
|                 self.load() | ||||
|                 real_source_palette = self.im.getpalette("RGB")[:768] | ||||
|             else:  # L-mode | ||||
|                 real_source_palette = bytearray(i // 3 for i in range(768)) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user