Skip to content

Commit 167ed55

Browse files
committed
Use elif
1 parent a4f976c commit 167ed55

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

src/PIL/TiffImagePlugin.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,17 +1559,6 @@ def _setup(self) -> None:
15591559
# fillorder==2 modes have a corresponding
15601560
# fillorder=1 mode
15611561
self._mode, rawmode = OPEN_INFO[key]
1562-
# libtiff always returns the bytes in native order.
1563-
# we're expecting image byte order. So, if the rawmode
1564-
# contains I;16, we need to convert from native to image
1565-
# byte order.
1566-
if rawmode == "I;16":
1567-
rawmode = "I;16N"
1568-
if ";16B" in rawmode:
1569-
rawmode = rawmode.replace(";16B", ";16N")
1570-
if ";16L" in rawmode:
1571-
rawmode = rawmode.replace(";16L", ";16N")
1572-
15731562
# YCbCr images with new jpeg compression with pixels in one plane
15741563
# unpacked straight into RGB values
15751564
if (
@@ -1578,6 +1567,16 @@ def _setup(self) -> None:
15781567
and self._planar_configuration == 1
15791568
):
15801569
rawmode = "RGB"
1570+
# libtiff always returns the bytes in native order.
1571+
# we're expecting image byte order. So, if the rawmode
1572+
# contains I;16, we need to convert from native to image
1573+
# byte order.
1574+
elif rawmode == "I;16":
1575+
rawmode = "I;16N"
1576+
elif ";16B" in rawmode:
1577+
rawmode = rawmode.replace(";16B", ";16N")
1578+
elif ";16L" in rawmode:
1579+
rawmode = rawmode.replace(";16L", ";16N")
15811580

15821581
# Offset in the tile tuple is 0, we go from 0,0 to
15831582
# w,h, and we only do this once -- eds

0 commit comments

Comments
 (0)