mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-28 08:59:57 +03:00
Removed qoi_ prefix from save argument
This commit is contained in:
parent
c4602b337e
commit
8ca44425c8
|
@ -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)
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
@ -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]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user