Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Tests/images/op_index.qoi
Binary file not shown.
6 changes: 6 additions & 0 deletions Tests/test_file_qoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ def test_invalid_file() -> None:

with pytest.raises(SyntaxError):
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)
2 changes: 1 addition & 1 deletion src/PIL/QoiImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int
assert self.fd is not None

self._previously_seen_pixels = {}
self._add_to_previous_pixels(bytearray((0, 0, 0, 255)))
self._previous_pixel = bytearray((0, 0, 0, 255))

data = bytearray()
bands = Image.getmodebands(self.mode)
Expand Down
Loading