mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Allow saving I;16 images as PPM
This commit is contained in:
parent
6a9acfa5ca
commit
8e730e17ae
|
@ -95,7 +95,9 @@ def test_16bit_pgm_write(tmp_path: Path) -> None:
|
|||
with Image.open("Tests/images/16_bit_binary.pgm") as im:
|
||||
filename = str(tmp_path / "temp.pgm")
|
||||
im.save(filename, "PPM")
|
||||
assert_image_equal_tofile(im, filename)
|
||||
|
||||
im.convert("I;16").save(filename, "PPM")
|
||||
assert_image_equal_tofile(im, filename)
|
||||
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
|||
rawmode, head = "1;I", b"P4"
|
||||
elif im.mode == "L":
|
||||
rawmode, head = "L", b"P5"
|
||||
elif im.mode == "I":
|
||||
elif im.mode in ("I", "I;16"):
|
||||
rawmode, head = "I;16B", b"P5"
|
||||
elif im.mode in ("RGB", "RGBA"):
|
||||
rawmode, head = "RGB", b"P6"
|
||||
|
|
Loading…
Reference in New Issue
Block a user