From 6e78c4d35990f48ae84d40df389ba4ba87da8fe4 Mon Sep 17 00:00:00 2001 From: Tao Peng Date: Wed, 22 May 2024 19:49:14 -0700 Subject: [PATCH] fix DNG image processing --- mapillary_tools/exif_write.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mapillary_tools/exif_write.py b/mapillary_tools/exif_write.py index 51871de2..c1ad7039 100644 --- a/mapillary_tools/exif_write.py +++ b/mapillary_tools/exif_write.py @@ -182,6 +182,14 @@ def _safe_dump(self) -> bytes: # retry later else: raise exc + except Exception as exc: + zeroth_ifd = self._ef.get("0th", {}) + # workaround: https://github.com/mapillary/mapillary_tools/issues/662 + if piexif.ImageIFD.AsShotNeutral in zeroth_ifd: + del zeroth_ifd[piexif.ImageIFD.AsShotNeutral] + assert piexif.ImageIFD.AsShotNeutral not in zeroth_ifd + else: + raise exc else: break