From 6840bb9ebae6cfa3da061e18762e7db9718eac32 Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Sun, 21 Nov 2021 18:39:35 -0500 Subject: [PATCH] plug-ins: fix #7109 exported gimp .jpg not processable in Windows Photo Viewer In cases where the whole EXIF MakerNote is invalid we still load that MakerNote data and export it too, causing partial invalid EXIF metadata. We don't need to explicitly save Exif.Photo.MakerNote at all, because as soon as we try to save a brand specific tag exiv2 will create that MakerNote tag itself. So from now we don't save the MakerNote but only the tags that go in it. In issues like #2159 where exiv2 doesn't parse all tags inside certain brand specific MakerNotes correctly, we will still export invalid EXIF. That is an exiv2 issue that we can't do much about unless we remove all MakerNote metadata including those that we can read, which doesn't seem like a good idea at all. --- libgimpbase/gimpmetadata.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c index 329a0e0eb4..800969c627 100644 --- a/libgimpbase/gimpmetadata.c +++ b/libgimpbase/gimpmetadata.c @@ -143,7 +143,18 @@ static const gchar *unsupported_tags[] = (PreviewResolution, PreviewLength, PreviewImageBorders) also make no sense because we are not including a Pentax specific preview image. */ "Exif.Pentax.Preview", - "Exif.PentaxDng.Preview" + "Exif.PentaxDng.Preview", + /* Never save the complete brand specific MakerNote data. We load and + * should only save the specific brand tags inside the MakerNote. + * Sometimes the MakerNote is invalid or exiv2 doesn't know how to parse + * it. In that case we still get the (invalid) MakerNote, but not the + * individual tags or just a subset of them. + * If there are recognized brand specific tags, exiv2 will create the + * required MakerNote itself (which in can still be invalid but that's an + * exiv2 issue not ours). */ + "Exif.Photo.MakerNote", + "Exif.MakerNote.ByteOrder", + "Exif.MakerNote.Offset", }; static const guint8 minimal_exif[] =