Skip to content

Commit 2d9c4e6

Browse files
authored
Merge pull request #7302 from radarhere/png_i16
Allow saving I;16B images as PNG
2 parents 1e7dcd3 + 2db354a commit 2d9c4e6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Tests/test_file_png.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ def test_sanity(self, tmp_path):
9292
assert im.format == "PNG"
9393
assert im.get_format_mimetype() == "image/png"
9494

95-
for mode in ["1", "L", "P", "RGB", "I", "I;16"]:
95+
for mode in ["1", "L", "P", "RGB", "I", "I;16", "I;16B"]:
9696
im = hopper(mode)
9797
im.save(test_file)
9898
with Image.open(test_file) as reloaded:
99-
if mode == "I;16":
99+
if mode in ("I;16", "I;16B"):
100100
reloaded = reloaded.convert(mode)
101101
assert_image_equal(reloaded, im)
102102

src/PIL/PngImagePlugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ def getxmp(self):
10421042
"LA": ("LA", b"\x08\x04"),
10431043
"I": ("I;16B", b"\x10\x00"),
10441044
"I;16": ("I;16B", b"\x10\x00"),
1045+
"I;16B": ("I;16B", b"\x10\x00"),
10451046
"P;1": ("P;1", b"\x01\x03"),
10461047
"P;2": ("P;2", b"\x02\x03"),
10471048
"P;4": ("P;4", b"\x04\x03"),

0 commit comments

Comments
 (0)