mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Tiff: allow writing floating poitn tag values
Use the inverse logic used for loading floating point tag values to also write them out again.
This commit is contained in:
parent
0bc24cb213
commit
61fb1c5bd4
|
@ -517,6 +517,15 @@ class ImageFileDirectory(collections.MutableMapping):
|
|||
elif typ == 7:
|
||||
# untyped data
|
||||
data = value = b"".join(value)
|
||||
elif typ in (11, 12):
|
||||
# float value
|
||||
tmap = {11: 'f', 12: 'd'}
|
||||
if not isinstance(value, tuple):
|
||||
value = (value,)
|
||||
a = array.array(tmap[typ], value)
|
||||
if self.prefix != native_prefix:
|
||||
a.byteswap()
|
||||
data = a.tostring()
|
||||
elif isStringType(value[0]):
|
||||
# string data
|
||||
if isinstance(value, tuple):
|
||||
|
|
Loading…
Reference in New Issue
Block a user