How does exiftool "know" how to fix shifted makernotes?

Started by mattburns, April 13, 2011, 07:19:31 AM

Previous topic - Next topic

mattburns

Hi, Newbie here,

Firstly, big thanks to Phil for all your hard work with exiftool. I would have given up on my project by now if it wasn't for your helpful information.

Anyway, I'm writing some javascript  ::) to parse the serial number out of makernotes for as many cameras as I can.

You can see my attempts so far at http://www.stolencamerafinder.com/exifreader.jsp

Yesterday I tried to get "Internal Serial Number" out of this photo but it failed. I thought it was strange because it's a Panasonic FX-35 which is normally no problem for me.
http://www.mattburns.co.uk/temp/PanasonicFX-35.jpg

I found it fails in exiftool also... unless you pass the "-F" switch to "fix" it. Huzzah, now I understand, the file has been modified by some naughty software.

Can someone give me a brief overview of how this works in exiftool as I would like to emulate this behaviour in my javascript.

If you're interested, I have a bunch of test scripts for all the sample images that Phil has kindly shared on his site. Thanks Phil! Here's the Panasonic page... http://stolencamerafinder.googlecode.com/svn/trunk/scf-testdata/generated/supportedPanasonics.html

Thanks for looking,
Matt

Phil Harvey

I suggest reading the comments in the FixBase() function of lib/Image/ExifTool/MakerNotes.pm

Basically you analyze the offsets to see if they lie within the available data.  The only real problem is that most camera firmware developers do not understand the concept of an IFD, so there are many, many exceptions due to their monumental ineptitude.

Post back if you have any questions.

- 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 ($).

mattburns

Hi Phil, thanks for the response.

I've only just scratched the surface when it comes to the "corner-cases" of different manufacturers. I had enough fun when I started and was trying to understand why manufacturers seem to love flipping the endianness around...

I'm just going to continue adding the exceptions on a case by case basis and keep growing my (currently small) regression test suite. Once you pointed me in the right direction, I was able to parse the file I was having problems with using Microsoft's silly OffsetSchema tag.

Thanks again,
Matt

Phil Harvey

...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 ($).