mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Fix saving originally missing TIFF tags.
Don't incorrectly set the tag type to None if it was originally missing.
This commit is contained in:
parent
6e7553fb0f
commit
7e9c944caf
|
@ -1359,7 +1359,7 @@ def _save(im, fp, filename):
|
|||
IPTC_NAA_CHUNK, PHOTOSHOP_CHUNK, XMP):
|
||||
if key in im.tag_v2:
|
||||
ifd[key] = im.tag_v2[key]
|
||||
ifd.tagtype[key] = im.tag_v2.tagtype.get(key, None)
|
||||
ifd.tagtype[key] = im.tag_v2.tagtype[key]
|
||||
|
||||
# preserve ICC profile (should also work when saving other formats
|
||||
# which support profiles as TIFF) -- 2008-06-06 Florian Hoech
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import print_function
|
||||
import logging
|
||||
from io import BytesIO
|
||||
import struct
|
||||
|
||||
from helper import unittest, PillowTestCase, hopper, py3
|
||||
|
@ -103,6 +104,15 @@ class TestFileTiff(PillowTestCase):
|
|||
im._setup()
|
||||
self.assertEqual(im.info['dpi'], (71., 71.))
|
||||
|
||||
def test_save_setting_missing_resolution(self):
|
||||
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
|
||||
b = BytesIO()
|
||||
Image.open("Tests/images/10ct_32bit_128.tiff").save(
|
||||
b, format="tiff", resolution=123.45)
|
||||
im = Image.open(b)
|
||||
self.assertEqual(float(im.tag_v2[X_RESOLUTION]), 123.45)
|
||||
self.assertEqual(float(im.tag_v2[Y_RESOLUTION]), 123.45)
|
||||
|
||||
def test_invalid_file(self):
|
||||
invalid_file = "Tests/images/flower.jpg"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user