ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: nickspiker on October 23, 2022, 10:48:00 PM

Title: Bad IFD1 directory but there is only IFD0
Post by: nickspiker on October 23, 2022, 10:48:00 PM
Checking the validity of a .dng writer I'm working on and I tried to check as much as I could but I still can't figure out what's triggering this:
[ExifTool] - Warning : Bad IFD1 directory

Here's a link to the dng if you want to take a look:
https://mega.nz/file/ehBwzJ7S#2raYjJNqrk2uOdQfC0DYvmYAjSK4jcz4EDJHnwKlZn8

And is there a command I can put into exiftool to get more detail about warnings like this?
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: StarGeek on October 23, 2022, 11:24:54 PM
You can use this to see all the warnings and problems
exiftool -g1 -a -s -warning -validate badifd.dng

You can add -v3 (-verbose3) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose) to get a breakdown of the structure.  The -htmlDump option (https://exiftool.org/exiftool_pod.html#htmlDump-OFFSET) will give you an interactive HTML file.  See this post (https://exiftool.org/forum/index.php?topic=13920.msg74866#msg74866) for examples.

Phil will probably have to look at it closer but odds are that the IFD1 is mangled such that exiftool can't find any data.  Or maybe there's the start of an IFD1 but nothing else.
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: nickspiker on October 23, 2022, 11:51:14 PM
Yup.  That pretty much tells me what I need to know.
Thank you!
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: Phil Harvey on October 24, 2022, 08:19:54 AM
You forgot to write an IFD1 pointer at the end of IFD0.  If there is no IFD1, then you should write four zero bytes immediately after the last IFD0 directory entry.

- Phil
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: nickspiker on October 24, 2022, 12:36:06 PM
Copy that sir!
Thank you very much!
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: nickspiker on October 24, 2022, 01:02:41 PM
Now I just have minor warnings:
[minor] Odd offset for IFD0 tag 0x011a XResolution
but the tiff spec says to align with word boundaries which I don't understand because word lengths are dependent on the architecture, unless judging by your output, do they actually mean even numbered offsets?
Title: Re: Bad IFD1 directory but there is only IFD0
Post by: Phil Harvey on October 24, 2022, 09:00:23 PM
"Word" boundary means 2-byte boundary (yes, offsets must be even)

- Phil