mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #389 from wiredfool/libtiff-save
Take compression as an option in the save call for tiffs
This commit is contained in:
commit
b57d68e993
|
@ -915,7 +915,7 @@ def _save(im, fp, filename):
|
|||
|
||||
ifd = ImageFileDirectory(prefix)
|
||||
|
||||
compression = im.info.get('compression','raw')
|
||||
compression = im.encoderinfo.get('compression',im.info.get('compression','raw'))
|
||||
libtiff = compression in ["tiff_ccitt", "group3", "group4",
|
||||
"tiff_jpeg", "tiff_adobe_deflate",
|
||||
"tiff_thunderscan", "tiff_deflate",
|
||||
|
|
|
@ -92,6 +92,7 @@ def test_g4_write():
|
|||
assert_equal(reread.size,(500,500))
|
||||
_assert_noerr(reread)
|
||||
assert_image_equal(reread, rot)
|
||||
assert_equal(reread.info['compression'], 'group4')
|
||||
|
||||
assert_equal(reread.info['compression'], orig.info['compression'])
|
||||
|
||||
|
@ -107,6 +108,15 @@ def test_adobe_deflate_tiff():
|
|||
assert_no_exception(lambda: im.load())
|
||||
|
||||
|
||||
def test_g3_compression():
|
||||
i = Image.open('Tests/images/lena_g4_500.tif')
|
||||
out = tempfile("temp.tif")
|
||||
i.save(out, compression='group3')
|
||||
|
||||
reread = Image.open(out)
|
||||
assert_equal(reread.info['compression'], 'group3')
|
||||
assert_image_equal(reread, i)
|
||||
|
||||
def test_little_endian():
|
||||
im = Image.open('Tests/images/12bit.deflate.tif')
|
||||
assert_equal(im.getpixel((0,0)), 480)
|
||||
|
|
Loading…
Reference in New Issue
Block a user