Removed qoi_ prefix from save argument

This commit is contained in:
Andrew Murray 2025-06-12 19:08:45 +10:00
parent c4602b337e
commit 8ca44425c8
3 changed files with 6 additions and 9 deletions

View File

@ -41,13 +41,13 @@ def test_op_index() -> None:
def test_save(tmp_path: Path) -> None: def test_save(tmp_path: Path) -> None:
f = tmp_path / "temp.qoi" f = tmp_path / "temp.qoi"
im = hopper("RGB") im = hopper()
im.save(f, qoi_colorspace="sRGB") im.save(f, colorspace="sRGB")
assert_image_equal_tofile(im, f) assert_image_equal_tofile(im, f)
for image in ["Tests/images/default_font.png", "Tests/images/pil123rgba.png"]: for path in ("Tests/images/default_font.png", "Tests/images/pil123rgba.png"):
with Image.open(image) as im: with Image.open(path) as im:
im.save(f) im.save(f)
assert_image_equal_tofile(im, f) assert_image_equal_tofile(im, f)

View File

@ -1098,7 +1098,7 @@ Saving
The :py:meth:`~PIL.Image.Image.save` method can take the following keyword arguments: 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 If set to "sRGB", the colorspace will be written as sRGB with linear alpha, instead
of all channels being linear. of all channels being linear.

View File

@ -122,10 +122,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
msg = "Unsupported QOI image mode" msg = "Unsupported QOI image mode"
raise ValueError(msg) raise ValueError(msg)
if im.encoderinfo.get("qoi_colorspace") == "sRGB": colorspace = 0 if im.encoderinfo.get("colorspace") == "sRGB" else 1
colorspace = 0
else:
colorspace = 1
fp.write(b"qoif") fp.write(b"qoif")
fp.write(o32(im.size[0])) fp.write(o32(im.size[0]))