The problem is that if IPTC information is edited with PhotoMechanic, a copy of IFD0 is made and the offset at the start of the file (which is normally 0x10) is modified. Unfortunately, ExifTool (and maybe other utilities) use the first 12 bytes of the image as a "magic number" to recognize CR2 images. These bytes should be either 49 49 2a 00 10 00 00 00 43 52 02 00 (little endian) or 4d 4d 00 2a 00 00 00 10 43 52 02 00 (big endian). Otherwise the image isn't recognized as a valid CR2.
Hi Phil,
There are only two choices to add info to a TIFF-based RAW file such as the Canon CR2 and Nikon NEF. One is to rewrite the whole file which is what ExifTool and some camera manufacturer's software like Nikon Capture do. The other option is to relocate the main IFD which is what Photo Mechanic does to preserve the location of all RAW information. Photo Mechanic does this in such a way that it can undo the edits made to the file in case bonehead software fails to parse the TIFF-based format with a relocated IFD. However, we make no guarantees about being able to undo the edits we made if other software (such as ExifTool) rewrites the file.
And yes, unfortunately Apple is a prime offender regarding bad parsing of RAW files and we have posted bug reports about this too, which Apple did fix with CR2 files (but they haven't fixed ORF or 1D TIFFs and will need to be careful if they decide to support other TIFF-based RAW formats). Apple isn't the only software that uses incompetent parsing (Nikon's component given to Adobe to handle the D2X encrypted white balance is another which Thomas worked-around I believe), but Apple's parsing is particularly bad for whatever reason. For example, just add one single byte to the END of a E-300 ORF and Apple's OS, including Preview and Aperture, will produce a garbage image. This doesn't affect a C-8080 ORF, but relocating the IFD does break Apple's OS for ORFs.
This is the problem with TIFF-based files: they don't lend themselves to editing. I complained to Thomas Knoll about this with DNG and he is the one who suggested relocating the IFD which I was aware of but didn't want to do without a mechanism to undo (which I subsequently invented due to the requests of many users to be able to embed IPTC/XMP into RAW files). And now we discover that Microsoft's new Windows Media Photo format (WDP) is also based on TIFF! When will these people learn? Perhaps they figure it is best to stick with this well-known formatting schema despite its inadequacies, but there are other container formats that would have made a better choice. I suppose we can all blame Kodak for this since they started using a TIFF-based RAW format back with the DCS 4xx cameras and even gave the files a TIF extension
, causing many users to have a heart attack when seeing a tiny grayscale thumbnail when opening the RAW TIF files directly into Photoshop from their $26K camera. But at least Kodak left enough room in the file so that it was possible to insert TIFF tags without having to relocate everything. I hate to see what other hordes of bonehead software will break when parsing a modified WDP (hopefully Microsoft will address this issue of updating WDP files before it reaches 1.0).
My concerns about rewriting the entire RAW file as ExifTool does is that when new models come out, unless ExifTool is careful to only update based on known models then it can potentially corrupt the RAW photos and I don't think there is a way to undo this (or is this planned for ExifTool?). Its one thing for the camera manufacturer to rewrite the file since they own the proprietary format, but when modifying proprietary formats one should tread very carefully.
Camera manufactures that continue to create proprietary RAW files demonstrate their lack of ingenuity or care for end users, not sure which (or both). And I don't think DNG is the answer either since it allows proprietary data inside of its openly defined format (which is controlled by Adobe).
PS - I thought a CR2 file was recognized as a Canon RAW file by its .CR2 filename extension?
But thanks for making the fix in the new ExifTool to handle the patched IFD offset. ExifTool is quite amazing at digging out info from the various formats.
Dennis