LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
201 stars 39 forks source link

Cannot open DNG files #16

Closed djotaku closed 4 years ago

djotaku commented 4 years ago

traceback:

Traceback (most recent call last): File "/home/ermesa/Programming Projects/python/photo_stats/photostats/lenses.py", line 66, in test_exif = get_exif.get_exif(test_photos) File "/home/ermesa/Programming Projects/python/photo_stats/photostats/get_exif.py", line 44, in get_exif this_image = Image(image) File "/home/ermesa/Programming Projects/python/photo_stats/venv/lib64/python3.7/site-packages/pyexiv2/core.py", line 16, in init self.img = api.open_image(filename.encode(encoding)) RuntimeError: Directory Canon with 25665 entries considered invalid; not read.

file: https://www.dropbox.com/s/c1i96a743mx0svj/Canon%20EOS%20Rebel%20XT.dng?dl=0

LeoHsiao1 commented 4 years ago

This is an error that exiv2 encountered while reading the image. This could happen in two ways:

  1. This error is fatal and prevents you from reading the image.
  2. This error is a warning that you can choose to ignore.

In the first case, there was nothing I could do. In the second case, you can increase the log level to ignore the warning:

>>> import pyexiv2
>>> pyexiv2.set_log_level(4)
>>> img = pyexiv2.Image(r'.\pyexiv2\tests\1.jpg')
>>> img.close()

Reference: log

LeoHsiao1 commented 4 years ago

Does that solve your problem?

djotaku commented 4 years ago

Excellent! It totally does! Thank you!

github-actions[bot] commented 3 years ago

This issue has been automatically closed because there has been no activity for a month.