Use constants for tag types

This commit is contained in:
Andrew Murray 2019-02-19 19:45:53 +11:00
parent daa8b51339
commit 9e52fb0fe4

View File

@ -423,7 +423,7 @@ class ImageFileDirectory_v2(MutableMapping):
ifd = ImageFileDirectory_v2()
ifd[key] = 'Some Data'
ifd.tagtype[key] = 2
ifd.tagtype[key] = TiffTags.ASCII
print(ifd[key])
'Some Data'
@ -557,7 +557,7 @@ class ImageFileDirectory_v2(MutableMapping):
if info.type:
self.tagtype[tag] = info.type
else:
self.tagtype[tag] = 7
self.tagtype[tag] = TiffTags.UNDEFINED
if all(isinstance(v, IFDRational) for v in values):
self.tagtype[tag] = TiffTags.RATIONAL
elif all(isinstance(v, int) for v in values):
@ -872,7 +872,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
ifd = ImageFileDirectory_v1()
ifd[key] = 'Some Data'
ifd.tagtype[key] = 2
ifd.tagtype[key] = TiffTags.ASCII
print(ifd[key])
('Some Data',)