Skip Menu |

This queue is for tickets about the Image-ExifTool CPAN distribution.

Report information
The Basics
Id: 12165
Status: resolved
Worked: 55 min
Priority: 0/
Queue: Image-ExifTool

People
Owner: Nobody in particular
Requestors: fwp [...] fwpeters.us
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.93
Fixed in: 5.05



Subject: Trouble updating attributes in JPG from a Canon Rebel XT
I am having the following problem with 4.93 on both a Mac OS-X 10.3 box (using perl v5.8.1-RC3 as supplied by Apple) and on a PC with Windows XP-SP2 box (using Activeperl 5.8.6, binary build 811). I've recently purchased a Canon Rebel XT (aka Rebel 350D) camera (a very new model, just shipping in quantity in March) and am having trouble setting some attributes. Exiftool has no problem reading the attributes and jhead and acdsee can both set attributes. The following example illustrates the problem: fwp1@jester$ exiftool -Country="USA" rebelxt.jpg 1 image files updated fwp1@jester$ exiftool -Copyright="Frank Peters" rebelxt.jpg Error: Error reading ThumbnailImage data in IFD1 - rebelxt.jpg 0 image files updated 1 files weren't updated due to errors fwp1@jester$ exiftool -b -ThumbnailImage rebelxt.jpg > rebelxt-thumb.jpg fwp1@jester$ ls -l rebelxt-thumb.jpg -rw-r--r-- 1 fwp1 wheel 8396 6 Apr 09:34 rebelxt-thumb.jpg Notice that attempting to update the copyright tag fails with an error about reading the thumbnail, yet I can successfully extract the thumbnail from the same file (and the extracted thumbnail looks fine in an imageviewer). Also notice that I can update the country tag. The same problem also occurs when setting the Artist and UserComment attributes. This error occurs with a little more than half of the pictures I have taken with this camera. I've used it with pictures from my older Canon G3 with no problems. The attached script illustrates that the problem also occurs with a very simple script that uses the library. The image used in these examples is available on the web at http://www2.msstate.edu/~fwp1/rebelxt.jpg (Be warned, this is a 5MB file...every tool I use to reduce its size also makes the problem go away). Please let me know if I can provide further information.
#!/usr/bin/perl -w # Global defines #my $basePath = "c:\\Documents and Settings\\fwp1\\My Documents\\My Pictures"; my $basePath = "/tmp"; my $origInfo; use Image::ExifTool; my $exifTool = new Image::ExifTool; $exifTool->Options( DateFormat => '%Y %m %d %H %M %S %B'); while ($origFile = shift) { my $origInfo = $exifTool->ImageInfo($origFile, 'datetimeoriginal'); # $exifTool->SetNewValue('Copyright', 'Frank Peters <fwp@fwpeters.us'); $exifTool->SetNewValue('Country', 'USA'); $newFile = "new-${origFile}"; print "$origFile -> $newFile\n"; $exifTool->WriteInfo($origFile, $newFile) || die "Couldn't write file: " . $exifTool->GetValue('Error') . "\n"; $exifTool->SetNewValue(); }
Thanks for the bug report and test image. This appears to be a bug in the camera firmware because the image is written incorrectly. The problem is that (in the image you provided) that the reported thumbnail length is 10 bytes too long. This gives an error when rewriting the thumbnail because the writing code is more strict, and requires the thumbnail to exist within the EXIF information, but it runs outside this. If you extract the thumbnail and dump the end of the image you will see this: 20b0: 36 f8 db 5e 5c 7a 4f 8f e9 47 f6 76 1f f9 10 1f [6..^\zO..G.v....] 20c0: ff d9 ff d8 ff c4 01 a2 00 00 01 05 [............] The thumbnail ends with "ff d9" (the bytes after this are the Start Of Scan for the main image). It is really surprising and annoying how bad camera manufacturers are at writing image files. And of course, I have to deal with all of _their_ problems! Grrr.... OK. I'll see what I can do to patch this. Thanks.
I have patched this problem and version 4.9.4 should issue a warning and truncate the thumbnail image accordingly. Version 4.9.4 is now available from http:// owl.phy.queensu.ca/~phil/exiftool/ BTW. I didn't address your comment that you could write the Country tag but not the Copyright tag. The reason is that the Country tag doesn't exist in EXIF so it was defaulting to writing it into the XMP data. Since the EXIF information wasn't modified, this error wasn't detected. However, the Copyright tag exists in both EXIF and XMP information, and the ExifTool writes preferentially to the EXIF. If you wanted to write only XMP, you can specify -xmp:Copyright. I hope this makes sense, and let me know if you have any more problems. - Phil