File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -1355,19 +1355,19 @@ def _setup(self):
13551355 bps_count = 1
13561356 bps_count += len (extra_tuple )
13571357 bps_actual_count = len (bps_tuple )
1358- if bps_count < bps_actual_count :
1358+ samples_per_pixel = self .tag_v2 .get (
1359+ SAMPLESPERPIXEL ,
1360+ 3 if self ._compression == "tiff_jpeg" and photo in (2 , 6 ) else 1 ,
1361+ )
1362+ if samples_per_pixel < bps_actual_count :
13591363 # If a file has more values in bps_tuple than expected,
13601364 # remove the excess.
1361- bps_tuple = bps_tuple [:bps_count ]
1362- elif bps_count > bps_actual_count and bps_actual_count == 1 :
1365+ bps_tuple = bps_tuple [:samples_per_pixel ]
1366+ elif samples_per_pixel > bps_actual_count and bps_actual_count == 1 :
13631367 # If a file has only one value in bps_tuple, when it should have more,
13641368 # presume it is the same number of bits for all of the samples.
1365- bps_tuple = bps_tuple * bps_count
1369+ bps_tuple = bps_tuple * samples_per_pixel
13661370
1367- samples_per_pixel = self .tag_v2 .get (
1368- SAMPLESPERPIXEL ,
1369- 3 if self ._compression == "tiff_jpeg" and photo in (2 , 6 ) else 1 ,
1370- )
13711371 if len (bps_tuple ) != samples_per_pixel :
13721372 raise SyntaxError ("unknown data organization" )
13731373
You can’t perform that action at this time.
0 commit comments