mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Replace tiff_jpeg with jpeg compression when saving
This commit is contained in:
parent
4634eafe3c
commit
aa1761bc9f
|
@ -448,6 +448,14 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
assert size_compressed > size_jpeg
|
assert size_compressed > size_jpeg
|
||||||
assert size_jpeg > size_jpeg_30
|
assert size_jpeg > size_jpeg_30
|
||||||
|
|
||||||
|
def test_tiff_jpeg_compression(self, tmp_path):
|
||||||
|
im = hopper("RGB")
|
||||||
|
out = str(tmp_path / "temp.tif")
|
||||||
|
im.save(out, compression="tiff_jpeg")
|
||||||
|
|
||||||
|
with Image.open(out) as reloaded:
|
||||||
|
assert reloaded.info["compression"] == "jpeg"
|
||||||
|
|
||||||
def test_quality(self, tmp_path):
|
def test_quality(self, tmp_path):
|
||||||
im = hopper("RGB")
|
im = hopper("RGB")
|
||||||
out = str(tmp_path / "temp.tif")
|
out = str(tmp_path / "temp.tif")
|
||||||
|
|
|
@ -1427,6 +1427,9 @@ def _save(im, fp, filename):
|
||||||
compression = im.encoderinfo.get("compression", im.info.get("compression"))
|
compression = im.encoderinfo.get("compression", im.info.get("compression"))
|
||||||
if compression is None:
|
if compression is None:
|
||||||
compression = "raw"
|
compression = "raw"
|
||||||
|
elif compression == "tiff_jpeg":
|
||||||
|
# OJPEG is obsolete, so use new-style JPEG compression instead
|
||||||
|
compression = "jpeg"
|
||||||
|
|
||||||
libtiff = WRITE_LIBTIFF or compression != "raw"
|
libtiff = WRITE_LIBTIFF or compression != "raw"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user