Skip to content

Commit

Permalink
Put upper limit on rows per strip
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Jun 2, 2021
1 parent d5b4012 commit b3e13a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PIL/TiffImagePlugin.py
Expand Up @@ -1555,7 +1555,7 @@ def _save(im, fp, filename):
stride = len(bits) * ((im.size[0] * bits[0] + 7) // 8)
# aim for 64 KB strips when using libtiff writer
if libtiff:
rows_per_strip = (2 ** 16 + stride - 1) // stride
rows_per_strip = min((2 ** 16 + stride - 1) // stride, im.size[1])
else:
rows_per_strip = im.size[1]
strip_byte_counts = stride * rows_per_strip
Expand Down

0 comments on commit b3e13a5

Please sign in to comment.