mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Fixed saving L mode GIF with background as WebP
This commit is contained in:
parent
a6a843e548
commit
b0d0d2b9cc
BIN
Tests/images/no_palette_with_background.gif
Normal file
BIN
Tests/images/no_palette_with_background.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 B |
|
@ -187,6 +187,12 @@ class TestFileWebp:
|
|||
|
||||
@skip_unless_feature("webp_anim")
|
||||
def test_background_from_gif(self, tmp_path):
|
||||
# Save L mode GIF with background
|
||||
with Image.open("Tests/images/no_palette_with_background.gif") as im:
|
||||
out_webp = str(tmp_path / "temp.webp")
|
||||
im.save(out_webp, save_all=True)
|
||||
|
||||
# Save P mode GIF with background
|
||||
with Image.open("Tests/images/chi.gif") as im:
|
||||
original_value = im.convert("RGB").getpixel((1, 1))
|
||||
|
||||
|
|
|
@ -190,7 +190,9 @@ def _save_all(im, fp, filename):
|
|||
palette = im.getpalette()
|
||||
if palette:
|
||||
r, g, b = palette[background * 3 : (background + 1) * 3]
|
||||
background = (r, g, b, 0)
|
||||
background = (r, g, b, 255)
|
||||
else:
|
||||
background = (background, background, background, 255)
|
||||
|
||||
duration = im.encoderinfo.get("duration", im.info.get("duration", 0))
|
||||
loop = im.encoderinfo.get("loop", 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user