mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Merge pull request #7779 from radarhere/gif
Match mask size to pasted image size in GifImagePlugin
This commit is contained in:
commit
1b25019a27
|
@ -1113,6 +1113,21 @@ def test_append_images(tmp_path: Path) -> None:
|
|||
assert reread.n_frames == 10
|
||||
|
||||
|
||||
def test_append_different_size_image(tmp_path: Path) -> None:
|
||||
out = str(tmp_path / "temp.gif")
|
||||
|
||||
im = Image.new("RGB", (100, 100))
|
||||
bigger_im = Image.new("RGB", (200, 200), "#f00")
|
||||
|
||||
im.save(out, save_all=True, append_images=[bigger_im])
|
||||
|
||||
with Image.open(out) as reread:
|
||||
assert reread.size == (100, 100)
|
||||
|
||||
reread.seek(1)
|
||||
assert reread.size == (100, 100)
|
||||
|
||||
|
||||
def test_transparent_optimize(tmp_path: Path) -> None:
|
||||
# From issue #2195, if the transparent color is incorrectly optimized out, GIF loses
|
||||
# transparency.
|
||||
|
|
|
@ -649,9 +649,7 @@ def _write_multiple_frames(im, fp, palette):
|
|||
if "transparency" in encoderinfo:
|
||||
# When the delta is zero, fill the image with transparency
|
||||
diff_frame = im_frame.copy()
|
||||
fill = Image.new(
|
||||
"P", diff_frame.size, encoderinfo["transparency"]
|
||||
)
|
||||
fill = Image.new("P", delta.size, encoderinfo["transparency"])
|
||||
if delta.mode == "RGBA":
|
||||
r, g, b, a = delta.split()
|
||||
mask = ImageMath.eval(
|
||||
|
|
Loading…
Reference in New Issue
Block a user