mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Use previous pixel alpha for QOI_OP_RGB
This commit is contained in:
parent
24606216e1
commit
7bf7ff8217
|
@ -2,7 +2,7 @@ import pytest
|
||||||
|
|
||||||
from PIL import Image, QoiImagePlugin
|
from PIL import Image, QoiImagePlugin
|
||||||
|
|
||||||
from .helper import assert_image_equal_tofile, assert_image_similar_tofile
|
from .helper import assert_image_equal_tofile
|
||||||
|
|
||||||
|
|
||||||
def test_sanity():
|
def test_sanity():
|
||||||
|
@ -18,7 +18,7 @@ def test_sanity():
|
||||||
assert im.size == (162, 150)
|
assert im.size == (162, 150)
|
||||||
assert im.format == "QOI"
|
assert im.format == "QOI"
|
||||||
|
|
||||||
assert_image_similar_tofile(im, "Tests/images/pil123rgba.png", 0.03)
|
assert_image_equal_tofile(im, "Tests/images/pil123rgba.png")
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_file():
|
def test_invalid_file():
|
||||||
|
|
|
@ -55,7 +55,7 @@ class QoiDecoder(ImageFile.PyDecoder):
|
||||||
while len(data) < self.state.xsize * self.state.ysize * bands:
|
while len(data) < self.state.xsize * self.state.ysize * bands:
|
||||||
byte = self.fd.read(1)[0]
|
byte = self.fd.read(1)[0]
|
||||||
if byte == 0b11111110: # QOI_OP_RGB
|
if byte == 0b11111110: # QOI_OP_RGB
|
||||||
value = self.fd.read(3) + o8(255)
|
value = self.fd.read(3) + self._previous_pixel[3:]
|
||||||
elif byte == 0b11111111: # QOI_OP_RGBA
|
elif byte == 0b11111111: # QOI_OP_RGBA
|
||||||
value = self.fd.read(4)
|
value = self.fd.read(4)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user