From ea35e19f51a30f882ccd43beb253a4634cb8fa42 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sun, 23 Apr 2006 15:20:28 +0000 Subject: [PATCH] Quick and temporary hack to decode the thumbnail from the makernote of Olympus TIFF files. A mechanism to cleanly extend the decoder with code like this will be required. --- src/tiffvisitor.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp index a95a4e73..2648ed0b 100644 --- a/src/tiffvisitor.cpp +++ b/src/tiffvisitor.cpp @@ -158,6 +158,25 @@ namespace Exiv2 { if (object->group() == Group::ignr) return; + // Experimental code to decode Olympus Thumbnail from the TIFF makernote + // into IFD1. + // Todo: this should go elsewhere. Ideally, such code to decode specific + // tag/group combinations could be added from outside + if (object->tag() == 0x0100 && object->group() == 257) { + const DataValue* v = dynamic_cast(object->pValue()); + if (v != 0) { + ExifData& exifData = pImage_->exifData(); + exifData["Exif.Thumbnail.Compression"] = uint16_t(6); + DataBuf buf(v->size()); + v->copy(buf.pData_); + Exifdatum& ed = exifData["Exif.Thumbnail.JPEGInterchangeFormat"]; + ed = uint32_t(0); + ed.setDataArea(buf.pData_, buf.size_); + exifData["Exif.Thumbnail.JPEGInterchangeFormatLength"] = uint32_t(buf.size_); + return; + } + } + // Todo: ExifKey should have an appropriate c'tor, it should not be // necessary to use groupName here ExifKey k(object->tag(), object->groupName());