mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-13 05:06:49 +03:00
Merge pull request #7357 from radarhere/qoi
This commit is contained in:
commit
faa2375f81
|
@ -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