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:
Björn Pedersen 2015-02-23 09:46:35 +01:00
parent 0bc24cb213
commit 61fb1c5bd4

View File

@ -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):