Writing Exif data to RAW files

Tobias Leupold tl at stonemx.de
Sun Sep 11 08:08:18 BST 2022


Am Samstag, 10. September 2022, 23:25:26 CEST schrieb Johannes Zarl-Zierl:
> Hi Tobias,
> 
> Am Samstag, 10. September 2022, 19:20:48 CEST schrieb Tobias Leupold:
> > Question is: Why is this disabled by default libkexiv2-side? And how
> > should
> > we deal with this? Add another option "Enable writing to RAW files"? And
> > only add "cr2" with the MIME type "image/x-canon-cr2", as we now know it
> > works for those?
> > 
> > I'm a bit unsure at this point ... all comments are welcome!
> 
> The feature seems to have been considered experimental when it was added:
> https://commits.kde.org/libkexiv2/a6deed7521d709bc303b0def98ae24dcec398461
> 
> I don't know, though, if that is still the case or if the libkexiv2 authors
> simply didn't come around to changing the defaults.
> 
> The safest way to handle any files that you can read but not reliably write
> would be to always write to sidecar files for those.
> 
> If I read the info on https://exiv2.org/whatsnew.html correctly, though, it
> seems that writing to raw files was considered experimental (on the exiv2
> side) only for the pre-release of 0.18. The 0.18 release does not mention
> the feature to be experimental.
> 
> Looking at the TIFF-related code in https://invent.kde.org/graphics/
> libkexiv2/-/blob/master/src/kexiv2_p.cpp#L209 I do understand the reasoning
> behind marking it experimental on the libkexiv2 side of things.
> 
> So defaulting to sidecar files for raw files (and maybe adding a warning
> when writing into raw files directly) seems to be the prudent way forward.
> 
> Cheers,
>   Johannes

Thanks for looking into this and for the clarification!

The current state of what I did is:

I tried to collect example files for all file types mentioned in the kexiv2 
sources (dng, nef, pef, orf, srw and cr2). From those, I actually could load 
(as well as e.g. Gwenview could) dng, nef and cr2.

I think I'll add those to the list of supported files, so that they show up 
using the file dilaog. When adding a whole folder, they are loaded anyway, 
because their MIME type inherits image/tiff.

Then, when writing metadata, I'll check if the respective image is a "normal" 
image, or a RAW one. If so, respectless of the setting, always an XMP sidecar 
file will be written.

Then, I'll also add an "Allow writing Exif data to RAW files" option, with the 
warning that this is experimental and one should have a backup. With this 
option set, I'll tell kexiv2 to write the headers directly.

This reflects what the library authors do, and we get support for three more 
image formats :-)




More information about the KGeoTag mailing list