mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-04 03:43:13 +03:00
Start QOI decoding with a zero-initialized array of previously seen pixels (#9008)
This commit is contained in:
commit
7f7c27f66a
BIN
Tests/images/op_index.qoi
Normal file
BIN
Tests/images/op_index.qoi
Normal file
Binary file not shown.
|
@ -28,3 +28,9 @@ def test_invalid_file() -> None:
|
||||||
|
|
||||||
with pytest.raises(SyntaxError):
|
with pytest.raises(SyntaxError):
|
||||||
QoiImagePlugin.QoiImageFile(invalid_file)
|
QoiImagePlugin.QoiImageFile(invalid_file)
|
||||||
|
|
||||||
|
|
||||||
|
def test_op_index() -> None:
|
||||||
|
# QOI_OP_INDEX as the first chunk
|
||||||
|
with Image.open("Tests/images/op_index.qoi") as im:
|
||||||
|
assert im.getpixel((0, 0)) == (0, 0, 0, 0)
|
||||||
|
|
|
@ -51,7 +51,7 @@ class QoiDecoder(ImageFile.PyDecoder):
|
||||||
assert self.fd is not None
|
assert self.fd is not None
|
||||||
|
|
||||||
self._previously_seen_pixels = {}
|
self._previously_seen_pixels = {}
|
||||||
self._add_to_previous_pixels(bytearray((0, 0, 0, 255)))
|
self._previous_pixel = bytearray((0, 0, 0, 255))
|
||||||
|
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
bands = Image.getmodebands(self.mode)
|
bands = Image.getmodebands(self.mode)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user