Merge pull request #5343 from radarhere/tiff_adobe_deflate

Replaced tiff_deflate with tiff_adobe_deflate compression when saving TIFF images
This commit is contained in:
Hugo van Kemenade 2021-03-19 08:46:39 +02:00 committed by GitHub
commit 0d7e205aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -471,6 +471,14 @@ class TestFileLibTiff(LibTiffTestCase):
with Image.open(out) as reloaded:
assert reloaded.info["compression"] == "jpeg"
def test_tiff_deflate_compression(self, tmp_path):
im = hopper("RGB")
out = str(tmp_path / "temp.tif")
im.save(out, compression="tiff_deflate")
with Image.open(out) as reloaded:
assert reloaded.info["compression"] == "tiff_adobe_deflate"
def test_quality(self, tmp_path):
im = hopper("RGB")
out = str(tmp_path / "temp.tif")

View File

@ -1442,6 +1442,8 @@ def _save(im, fp, filename):
elif compression == "tiff_jpeg":
# OJPEG is obsolete, so use new-style JPEG compression instead
compression = "jpeg"
elif compression == "tiff_deflate":
compression = "tiff_adobe_deflate"
libtiff = WRITE_LIBTIFF or compression != "raw"