exiv2
exiv2 copied to clipboard
Changes to tagInfo to support Exif.Canon.AFInfo
I added a vector of keys (in src/exif.cpp) which must not be written by writeMetata().
WriteMethod ExifParser::encode(
Blob& blob,
const byte* pData,
uint32_t size,
ByteOrder byteOrder,
const ExifData& exifData
)
{
ExifData ed = exifData;
// Delete IFD0 tags that are "not recorded" in compressed images
// Reference: Exif 2.2 specs, 4.6.8 Tag Support Levels, section A
static const char* filteredIfd0Tags[] = {
"Exif.Image.PhotometricInterpretation",
...
"Exif.Image.SubIFDs",
// Issue 981. Never allow manufactured data to be written
"Exif.Canon.AFInfoSize",
...
"Exif.Canon.AFAreaMode",
"Exif.Canon.AFPointsUnusable",
};
Because I was working on 0.27-maintenance, I could not modify the API. However a better way would be to add a bool bManufactured
field to tagInfo to indicate that this tag must never be written.
525 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $ nm -g --demangle lib/libexiv2.dylib | grep Exiv2::TagInfo::TagInfo
000000000006ecac T Exiv2::TagInfo::TagInfo(unsigned short, char const*, char const*, char const*, int, int, Exiv2::TypeId, short, std::__1::basic_ostream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Exiv2::Value const&, Exiv2::ExifData const*))
000000000006ed20 T Exiv2::TagInfo::TagInfo(unsigned short, char const*, char const*, char const*, int, int, Exiv2::TypeId, short, std::__1::basic_ostream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Exiv2::Value const&, Exiv2::ExifData const*))
526 rmills@rmillsm1:~/gnu/github/exiv2/0.27-maintenance/build $
If tagInfo is modified, the code in taglist.cpp should be modified and propagated to the web-site documentation. A challenging task.
It is possible to edit the "raw" tag Exif.Canon.AFInfo which is an array of shorts and recorded by the camera. I'm not a photographer, however I understand that decoding this is useful when post-processing the image. Only an expert can modify Exif.Canon.AFInfo. Tags such as Exif.Canon.AFNumPoints are correctly treated as read-only because they "manufactured" by the data in Exif.Canon.AFInfo.