Thread

Posted on Fri Dec 7 01:55:23 2007 by msbc
Error copying Tags
I'm trying to copy metadata from an original Canon CR2 to a JPG version using -TagFromFile. Tried this with 7.03 and 7.05, with and without the additional -all:all option. I get the same error message
$ exiftool -TagsFromFile 20050910-8582.CR2 20050910-8582.jpg Error: Bad format (0) for IFD0 entry 6 - 20050910-8582.jpg

Not sure what this means. Is there a way to fix this problem?
Direct Responses: 6633 | Write a response
Posted on Fri Dec 7 02:24:22 2007 by exiftool in response to 6632
Re: Error copying Tags
The EXIF information in your JPEG image is corrupt.

ExifTool will not rewrite EXIF information which has such a severe problem due to the high probability that information will be lost. However, you can use exiftool to repair the file. Here are the steps:

1) Make a copy of the JPEG image (let's call it "new.jpg").

2) use "exiftool -exif:all= new.jpg" to remove all EXIF information.

3) use "exiftool -tagsfromfile 20050910-8582.jpg -all:all new.jpg" to copy any recoverable information from the original image (we know at least one tag won't be copied because of the invalid format code, but if you are lucky the rest of the information may still be good).

4) now go ahead and copy your CR2 tags to "new.jpg".

- Phil
Direct Responses: 6634 | 6768 | Write a response
Posted on Fri Dec 7 03:29:45 2007 by msbc in response to 6633
Re: Error copying Tags
Phil, That worked great and allowed me to copy all the tags from the CR2.

I notice that the PreviewImage is also copied (though the online doc says it will be excluded). Is there a way to exclude the CR2 preview and thumbnail (not sure of the difference?) being copied and keep the ones already in the JPG?
Direct Responses: 6635 | Write a response
Posted on Fri Dec 7 03:37:46 2007 by msbc in response to 6634
Re: Error copying Tags
Doh! RTFM!! Answered my own question - just had to put the --Tag between the src and dest image names. I also think I was wrong in saying the Previewimage was copied - it was the ThumbnailImage I had to delete.
Direct Responses: 6639 | Write a response
Posted on Fri Dec 7 14:05:11 2007 by exiftool in response to 6635
Re: Error copying Tags
Glad you figured that out.
Write a response
Posted on Fri Dec 28 08:09:36 2007 by robladdish in response to 6633
Re: Error copying Tags
Hi Phil, First off, thanks for an awesome tool! You've done a great job of managing the complexity with easy options. That's hard to do well! I have a similar problem as this poster. I have a lot of images stored from an older Fuji FinePix 601z camera that I'm trying to organize. It's finding corruption in the header & declining to write to the tag header:
$ exiftool -m -Software=Fred test_bak.jpg Warning: Truncated MakerNotes directory - test_bak.jpg Error: Bad format (1792) for ExifIFD entry 19 - test_bak.jpg 0 image files updated 1 files weren't updated due to errors I tried a similar process to what you did above - make a copy, remove exif tags, copy exif tags, an +d continue. Unfortunately, it seems to copy the corruption, and the error remains. Do you have any + suggestions? Here's the relevant output: $ copy test.jpg test_bak.jpg $ exiftool -exif:all= test_bak.jpg 1 image files updated $ exiftool -m -Software=Fred test_bak.jpg 1 image files updated This implies the clearing of tags removed the problem. $ exiftool -exif:all= test_bak.jpg 1 image files updated $ exiftool -tagsfromfile test.jpg test_bak.jpg Warning: Bad MakerNotes directory - test.jpg 1 image files updated $ exiftool -m -Software=Fred test_bak.jpg Warning: Truncated MakerNotes directory - test_bak.jpg Error: Bad format (1792) for ExifIFD entry 19 - test_bak.jpg 0 image files updated 1 files weren't updated due to errors This implied to me that the corruption got copied over too. :( Here's some more verbose output in case it helps: P:\ArchiveMisc\Home TV Copies>exiftool -v2 -m -Software=Fred test_bak.jpg Writing PNG:Software Writing MIE-Doc:Software Writing Sigma:Software if tag exists Writing XMP-tiff:Software if tag exists Writing IFD0:Software Rewriting test_bak.jpg... Editing tags in: APP0 APP1 CIFF ExifIFD IFD0 JFIF MIE-Doc MakerNotes PNG XMP Creating tags in: APP1 IFD0 MIE-Doc PNG JPEG APP1 (8182 bytes): ExifByteOrder = MM Rewriting IFD0 - IFD0:Software = 'Adobe Photoshop Elements 6.0' + IFD0:Software = 'Fred' Rewriting ExifIFD Rewriting MakerNotes Warning = Truncated MakerNotes directory Deleting MakerNotes Error = Bad format (1792) for ExifIFD entry 19 JPEG APP13 (142 bytes): JPEG APP1 (5718 bytes): Rewriting XMP JPEG DQT (65 bytes): JPEG DQT (65 bytes): JPEG DQT (65 bytes): JPEG SOF0: JPEG DHT (29 bytes): JPEG DHT (179 bytes): JPEG DHT (29 bytes): JPEG DHT (179 bytes): JPEG DRI (2 bytes): JPEG SOS Warning: Truncated MakerNotes directory - test_bak.jpg Error: Bad format (1792) for ExifIFD entry 19 - test_bak.jpg 0 image files updated 1 files weren't updated due to errors
Thanks for any help!
Direct Responses: 6769 | Write a response
Posted on Fri Dec 28 08:33:40 2007 by robladdish in response to 6768
Re: Error copying Tags
Ahah! Posting the problem got me to thinking about it again, and I found I could exclude MakerNotes from the tag recopy. Nevermind it's working now. :) If others are curious, here's the snippet of code I used within Perl. (Camera_id formed from Make and Model tags, I then set other tags and call $exifTool->WriteInfo after this code to make it all stick)
if ($camera_id =~ /^FUJIFILM FinePix F601 ZOOM/i) { system("exiftool -overwrite_original -q -exif:all= \"$dest_file\""); system("exiftool -overwrite_original -q -q -tagsfromfile \"$src_file\" --MakerNotes \"$dest_file\" +"); }
Direct Responses: 6770 | Write a response
Posted on Fri Dec 28 14:54:42 2007 by exiftool in response to 6769
Re: Error copying Tags
Hi Rob,

I'm glad you sorted it out. As you have discovered, sometimes when exiftool issues a makernote warning during writing it will fall back to just copying the offending information as-is instead of trying to restructure it properly. In your case this also caused the format error to be copied, although without seeing the image I can't tell what the specific problem was. I usually use the htmldump feature to debug this sort of format problem in case you're interested.

- Phil
Write a response