mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Merge pull request #6683 from radarhere/apng
This commit is contained in:
		
						commit
						a77eb671a1
					
				| 
						 | 
					@ -553,18 +553,20 @@ def test_apng_save_disposal(tmp_path):
 | 
				
			||||||
def test_apng_save_disposal_previous(tmp_path):
 | 
					def test_apng_save_disposal_previous(tmp_path):
 | 
				
			||||||
    test_file = str(tmp_path / "temp.png")
 | 
					    test_file = str(tmp_path / "temp.png")
 | 
				
			||||||
    size = (128, 64)
 | 
					    size = (128, 64)
 | 
				
			||||||
    transparent = Image.new("RGBA", size, (0, 0, 0, 0))
 | 
					    blue = Image.new("RGBA", size, (0, 0, 255, 255))
 | 
				
			||||||
    red = Image.new("RGBA", size, (255, 0, 0, 255))
 | 
					    red = Image.new("RGBA", size, (255, 0, 0, 255))
 | 
				
			||||||
    green = Image.new("RGBA", size, (0, 255, 0, 255))
 | 
					    green = Image.new("RGBA", size, (0, 255, 0, 255))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # test OP_NONE
 | 
					    # test OP_NONE
 | 
				
			||||||
    transparent.save(
 | 
					    blue.save(
 | 
				
			||||||
        test_file,
 | 
					        test_file,
 | 
				
			||||||
        save_all=True,
 | 
					        save_all=True,
 | 
				
			||||||
        append_images=[red, green],
 | 
					        append_images=[red, green],
 | 
				
			||||||
        disposal=PngImagePlugin.Disposal.OP_PREVIOUS,
 | 
					        disposal=PngImagePlugin.Disposal.OP_PREVIOUS,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    with Image.open(test_file) as im:
 | 
					    with Image.open(test_file) as im:
 | 
				
			||||||
 | 
					        assert im.getpixel((0, 0)) == (0, 0, 255, 255)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        im.seek(2)
 | 
					        im.seek(2)
 | 
				
			||||||
        assert im.getpixel((0, 0)) == (0, 255, 0, 255)
 | 
					        assert im.getpixel((0, 0)) == (0, 255, 0, 255)
 | 
				
			||||||
        assert im.getpixel((64, 32)) == (0, 255, 0, 255)
 | 
					        assert im.getpixel((64, 32)) == (0, 255, 0, 255)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1128,7 +1128,7 @@ def _write_multiple_frames(im, fp, chunk, rawmode, default_image, append_images)
 | 
				
			||||||
                    prev_disposal = Disposal.OP_BACKGROUND
 | 
					                    prev_disposal = Disposal.OP_BACKGROUND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if prev_disposal == Disposal.OP_BACKGROUND:
 | 
					                if prev_disposal == Disposal.OP_BACKGROUND:
 | 
				
			||||||
                    base_im = previous["im"]
 | 
					                    base_im = previous["im"].copy()
 | 
				
			||||||
                    dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0))
 | 
					                    dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0))
 | 
				
			||||||
                    bbox = previous["bbox"]
 | 
					                    bbox = previous["bbox"]
 | 
				
			||||||
                    if bbox:
 | 
					                    if bbox:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user