From b5d6a73da9533ed5510383a6302fa1f17bdfe4a4 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 8 Oct 2021 12:53:53 +1100 Subject: [PATCH] Added test --- Tests/test_file_libtiff.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 1d0c93f06..ebc8e5e07 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -986,3 +986,16 @@ class TestFileLibTiff(LibTiffTestCase): with Image.open(out) as im: # Assert that there are multiple strips assert len(im.tag_v2[STRIPOFFSETS]) > 1 + + def test_save_single_strip(self, tmp_path): + im = hopper("RGB").resize((256, 256)) + out = str(tmp_path / "temp.tif") + + TiffImagePlugin.STRIP_SIZE = 2 ** 18 + im.save(out, compression="tiff_adobe_deflate") + + try: + with Image.open(out) as im: + assert len(im.tag_v2[STRIPOFFSETS]) == 1 + finally: + TiffImagePlugin.STRIP_SIZE = 65536