mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-15 18:52:19 +03:00
Fixed pasting an L frame onto an RGB(A) GIF
This commit is contained in:
parent
53664c5f69
commit
ae6520ccd6
BIN
Tests/images/no_palette_after_rgb.gif
Normal file
BIN
Tests/images/no_palette_after_rgb.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 101 B |
|
@ -83,6 +83,15 @@ def test_l_mode_transparency():
|
||||||
assert im.load()[0, 0] == 128
|
assert im.load()[0, 0] == 128
|
||||||
|
|
||||||
|
|
||||||
|
def test_l_mode_after_rgb():
|
||||||
|
with Image.open("Tests/images/no_palette_after_rgb.gif") as im:
|
||||||
|
im.seek(1)
|
||||||
|
assert im.mode == "RGB"
|
||||||
|
|
||||||
|
im.seek(2)
|
||||||
|
assert im.mode == "RGB"
|
||||||
|
|
||||||
|
|
||||||
def test_strategy():
|
def test_strategy():
|
||||||
with Image.open("Tests/images/chi.gif") as im:
|
with Image.open("Tests/images/chi.gif") as im:
|
||||||
expected_zero = im.convert("RGB")
|
expected_zero = im.convert("RGB")
|
||||||
|
|
|
@ -432,16 +432,13 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
self.mode = "RGB"
|
self.mode = "RGB"
|
||||||
self.im = self.im.convert("RGB", Image.Dither.FLOYDSTEINBERG)
|
self.im = self.im.convert("RGB", Image.Dither.FLOYDSTEINBERG)
|
||||||
return
|
return
|
||||||
if self.mode == "P" and self._prev_im:
|
if not self._prev_im:
|
||||||
if self._frame_transparency is not None:
|
return
|
||||||
self.im.putpalettealpha(self._frame_transparency, 0)
|
if self._frame_transparency is not None:
|
||||||
frame_im = self.im.convert("RGBA")
|
self.im.putpalettealpha(self._frame_transparency, 0)
|
||||||
else:
|
frame_im = self.im.convert("RGBA")
|
||||||
frame_im = self.im.convert("RGB")
|
|
||||||
else:
|
else:
|
||||||
if not self._prev_im:
|
frame_im = self.im.convert("RGB")
|
||||||
return
|
|
||||||
frame_im = self.im
|
|
||||||
frame_im = self._crop(frame_im, self.dispose_extent)
|
frame_im = self._crop(frame_im, self.dispose_extent)
|
||||||
|
|
||||||
self.im = self._prev_im
|
self.im = self._prev_im
|
||||||
|
|
Loading…
Reference in New Issue
Block a user