News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Bad EquipmentIFD directory

Started by colinmcc, November 24, 2015, 04:18:42 PM

Previous topic - Next topic

colinmcc

I am trying to write some data to a JPG from the command line in Linux.

If I do:  exiftool -Comment='Fred likes this' Fred_full.JPG all is well, and the message 1 image files updated occurs and on running exiftool -g Fred_full.JPG>Fred_full.txt I can see the Comment: Fred likes this in the file.

But, trying to add text to other tags, for example : exiftool -Artist='Fred' Fred_full.JPG results in:
Error: [minor] Bad EquipmentIFD directory - Fred_full.JPG
    0 image files updated
    1 files weren't updated due to errors


Thinking that perhaps the file had been corrupted in writing the first comment, I try running exiftool -Comment='Fred dislikes this' Fred_full.JPG
and find that it works fine, the Comment has changed to Fred dislikes this..

My question, why am I getting the error when trying to update some fields if it doesn't occur with writing to the Comment field, surely the IFD directory is the same in both cases? I'm confused!
Thanks.

StarGeek

Quote from: colinmcc on November 24, 2015, 04:18:42 PM
My question, why am I getting the error when trying to update some fields if it doesn't occur with writing to the Comment field, surely the IFD directory is the same in both cases? I'm confused!

You don't get the error writing the Comment tag because the comment is in a completely separate place than Artist.  Comment has it's own separate block in a jpeg (COM block).  Artist is in the EXIF data, which is in the APP1 block. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

colinmcc

Stargeek, Thank you.. Since this is the newbie section of the forum, could you please point me at a solution, or, at least an explanation as to what you are saying? I don't understand how the directory can be corrupt in one case yet not in another.

StarGeek

I looked around the web but unfortunately I couldn't find a nice simple explanation of the jpeg file format.  You can read over the Wikipedia section on the format but it's still a bit complex.

An extremely simplified way to think of it might be like this.  Let's say the jpeg file is a printed page with the actual picture at the bottom.  Above the picture are several sections, like you were filling out a tax form.  One of these sections is the COM section and has a place to fill out the comment.  A different section is the APP1 section and has spaces to fill out all the EXIF information.  This section is where you fill out Artist.  There are also other sections for IPTC and XMP (and other) data.  But if those sections don't apply to your picture or you don't want them there, you just skip those sections.

Now, in your case, something happened at the printer and some of the APP1 section of your form were left blank or maybe double printed, but the rest of the page is fine.  Basically, you can't figure out where to write in the Artist.  You can see where to fill out comment easily enough, but where the Artist is supposed to be is a mess.  So you can't fill it out correctly.

That's about all I can come up with as a metaphor this late at night.  It not a great example, but I hope it can help.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

#4
The ExifTool-supported types of JPEG meta information are listed here, and Figure 7 on page 20 of the Exif 2.3 specification shows the basic structure of a JPEG file.

As StarGeek said, there are separate containers (segments) in a JPEG-format file, with Artist in the EXIF APP1 segment, and Comment in the COM segment.  ExifTool doesn't open the EXIF container if you are only writing a Comment, which is why your first command didn't give an error. 

That being said, this is a minor error and may be ignored.  Read FAQ 15 for more information.

- Phil

Edit:  A quick forum search for "Bad EquipmentIFD directory" reveals this thread, which gives a possible way for the image to get corrupted like this.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

colinmcc

Thanks to you both! I had resized and cropped  the image with GIMP, I'll try with the original un-cropped version in case it was GIMP rewriting the modified file that had messed up the EXIF APP1 segment. Will report back the result.

I found a good explanation of the layout and parsing of jpeg data at: http://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_JPEG_files including flowchart for reading the data.

And, Phil, wouldn't that error message be better, or at least more helpful to an ignoramus like me if it said something like 'Corrupted EXIF APP1 section detected in image, can't read or write to it '?

Phil Harvey

Quote from: colinmcc on November 25, 2015, 09:32:50 AM
I found a good explanation of the layout and parsing of jpeg data at: http://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_JPEG_files including flowchart for reading the data.

The flowcharts are interesting.  The layout is cribbed directly from the figure I referenced in the Exif specification.

QuoteAnd, Phil, wouldn't that error message be better, or at least more helpful to an ignoramus like me if it said something like 'Corrupted EXIF APP1 section detected in image, can't read or write to it '?

The error about the corrupted EquipmentIFD is more specific, and therefore much more useful to someone who knows what this is.  (I wouldn't have been able to give specific advice on this if I only had the generic error you suggested.)  The EquipmentIFD is a proprietary Olympus IFD inside the MakerNotes, which is why the error is flagged as "[minor]" and may be ignored with the -m option.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

colinmcc

Phil, many thanks, I now have read up on the concept of an "Image File Directory"  and am better informed!  :D

And, I tried adding to the Author field in an image taken straight from the camera and it added the data fine, so I have to conclude that the corruption of the IFD took place in GIMP when I had previously edited the image mentioned above.  This sets my mind at rest since I have just bought the camera and thought it might be writing badly formed IFDs.

Thank you for a great tool BTW!