TNThieding / exif

Read and modify image EXIF metadata using Python.
https://gitlab.com/TNThieding/exif
MIT License
52 stars 7 forks source link

undef type not supported #11

Open gilesknap opened 5 years ago

gilesknap commented 5 years ago

Those exif values whose data type is listed as 'undef' in https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html cannot be viewed.

e.g. example image

with open('/home/hgv27681/Downloads/IMG_20190317_104705.jpg', 'rb') as image_file:
                ex = exif.Image(image_file)

ex.exif_version
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/hgv27681/.local/share/virtualenvs/exif-0yvCzAKq/lib/python3.7/site-packages/exif/_image.py", line 57, in __getattr__
    return getattr(self._segments['APP1'], item)
  File "/home/hgv27681/.local/share/virtualenvs/exif-0yvCzAKq/lib/python3.7/site-packages/exif/_app1_metadata.py", line 205, in __getattr__
    return ifd_tag.read()
  File "/home/hgv27681/.local/share/virtualenvs/exif-0yvCzAKq/lib/python3.7/site-packages/exif/_ifd_tag.py", line 145, in read
    retval = self._read_as_numeric()
  File "/home/hgv27681/.local/share/virtualenvs/exif-0yvCzAKq/lib/python3.7/site-packages/exif/_ifd_tag.py", line 211, in _read_as_numeric
    raise RuntimeError("unknown datatype value {0}".format(self.dtype))
RuntimeError: unknown datatype value 7

It's not clear how these values should be displayed so I'm not sure of the solution.

afaucon commented 5 years ago

I also have this issue, also with the value 7. It seems it is however a decodable datatype of 8bits, according to https://www.exif.org/Exif2-2.PDF page 14