From 8ca44425c80a8c74268d53268d9661dd0d9f5cb3 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 12 Jun 2025 19:08:45 +1000 Subject: [PATCH] Removed qoi_ prefix from save argument --- Tests/test_file_qoi.py | 8 ++++---- docs/handbook/image-file-formats.rst | 2 +- src/PIL/QoiImagePlugin.py | 5 +---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Tests/test_file_qoi.py b/Tests/test_file_qoi.py index 4222d2b94..1f415eaaa 100644 --- a/Tests/test_file_qoi.py +++ b/Tests/test_file_qoi.py @@ -41,13 +41,13 @@ def test_op_index() -> None: def test_save(tmp_path: Path) -> None: f = tmp_path / "temp.qoi" - im = hopper("RGB") - im.save(f, qoi_colorspace="sRGB") + im = hopper() + im.save(f, colorspace="sRGB") assert_image_equal_tofile(im, f) - for image in ["Tests/images/default_font.png", "Tests/images/pil123rgba.png"]: - with Image.open(image) as im: + for path in ("Tests/images/default_font.png", "Tests/images/pil123rgba.png"): + with Image.open(path) as im: im.save(f) assert_image_equal_tofile(im, f) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 9ce0ec13e..38016be96 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -1098,7 +1098,7 @@ Saving The :py:meth:`~PIL.Image.Image.save` method can take the following keyword arguments: -**qoi_colorspace** +**colorspace** If set to "sRGB", the colorspace will be written as sRGB with linear alpha, instead of all channels being linear. diff --git a/src/PIL/QoiImagePlugin.py b/src/PIL/QoiImagePlugin.py index aab0533e3..03b6a4b98 100644 --- a/src/PIL/QoiImagePlugin.py +++ b/src/PIL/QoiImagePlugin.py @@ -122,10 +122,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: msg = "Unsupported QOI image mode" raise ValueError(msg) - if im.encoderinfo.get("qoi_colorspace") == "sRGB": - colorspace = 0 - else: - colorspace = 1 + colorspace = 0 if im.encoderinfo.get("colorspace") == "sRGB" else 1 fp.write(b"qoif") fp.write(o32(im.size[0]))