Skip to content

Commit 700a8e9

Browse files
committed
Support converting between I;16N and L
1 parent 2755e0f commit 700a8e9

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Tests/test_mode_i16.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ def test_convert():
9090

9191
im = original.copy()
9292

93-
verify(im.convert("I;16"))
94-
verify(im.convert("I;16").convert("L"))
95-
verify(im.convert("I;16").convert("I"))
96-
97-
verify(im.convert("I;16B"))
98-
verify(im.convert("I;16B").convert("L"))
99-
verify(im.convert("I;16B").convert("I"))
93+
for mode in ("I;16", "I;16B", "I;16N"):
94+
verify(im.convert(mode))
95+
verify(im.convert(mode).convert("L"))
96+
verify(im.convert(mode).convert("I"))

src/libImaging/Convert.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,13 @@ static struct {
970970
{"I;16L", "L", I16L_L},
971971
{"L", "I;16B", L_I16B},
972972
{"I;16B", "L", I16B_L},
973+
#ifdef WORDS_BIGENDIAN
974+
{"L", "I;16N", L_I16B},
975+
{"I;16N", "L", I16B_L},
976+
#else
977+
{"L", "I;16N", L_I16L},
978+
{"I;16N", "L", I16L_L},
979+
#endif
973980

974981
{"I;16", "F", I16L_F},
975982
{"I;16L", "F", I16L_F},

0 commit comments

Comments
 (0)