Merge pull request #7357 from radarhere/qoi

This commit is contained in:
Hugo van Kemenade 2023-09-04 09:55:29 -06:00 committed by GitHub
commit faa2375f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import pytest
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():
@ -18,7 +18,7 @@ def test_sanity():
assert im.size == (162, 150)
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():

View File

@ -55,7 +55,7 @@ class QoiDecoder(ImageFile.PyDecoder):
while len(data) < self.state.xsize * self.state.ysize * bands:
byte = self.fd.read(1)[0]
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
value = self.fd.read(4)
else: