From 1f82202998db41f135878e96c2dfed1321323361 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 10 Feb 2022 11:08:25 +1100 Subject: [PATCH] Adjusted comments --- src/PIL/TiffImagePlugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index 307a08cea..d6f23f11b 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -1307,13 +1307,14 @@ class TiffImageFile(ImageFile.ImageFile): else: bps_count = 1 bps_count += len(extra_tuple) - # Some files have only one value in bps_tuple, - # while should have more. Or have more values - # than expected. Fix it bps_actual_count = len(bps_tuple) if bps_count < bps_actual_count: + # If a file has more values in bps_tuple than expected, + # remove the excess. bps_tuple = bps_tuple[:bps_count] elif bps_count > bps_actual_count and bps_actual_count == 1: + # If a file has only one value in bps_tuple, when it should have more, + # presume it is the same number of bits for all of the samples. bps_tuple = bps_tuple * bps_count samplesPerPixel = self.tag_v2.get(