Project

General

Profile

Bug #407

Writing metadata back to image after intrusive change looses thumbnail

Added by Andreas Huggel almost 15 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Category:
exif
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Read Exif data, add a tag (or make any other "intrusive change", write data back. The resulting Exif data has a corrupt JPEGInterchangeFormat offset.

The problem arises because
void addToIfd(Ifd& ifd, const Exifdatum& md, ByteOrder byteOrder)
writes the original absolute offset to the new Ifd entry and in
Entry::setDataAreaOffsets
it is assumed to be an offset relative to the start of the data.

Additional information:

Simple reproducer:

#include "exif.hpp"
int main(int argc, char* const argv[]) {
if (argc != 2) {
std::cout << "Usage: " << argv0 << " file\n";
return 1;
}
Exiv2::ExifData exifData;
exifData.read(argv1);
exifData["Exif.GPSInfo.GPSAltitude"] = Exiv2::URational(400, 1);
exifData.write(argv1);
return rc;
}

History

#1

Updated by Andreas Huggel almost 15 years ago

Rel. 474

Also available in: Atom PDF