Put upper limit on rows per strip

This commit is contained in:
Miloš Komarčević 2021-06-02 12:31:58 +02:00 committed by Andrew Murray
parent 1c4deefe11
commit 0ae2981957

View File

@ -1560,7 +1560,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