Main Menu

Offset in NEF-file

Started by Leo63, November 05, 2017, 09:11:02 AM

Previous topic - Next topic

Leo63

Hello all,

I'm very new to this forum and my native language isn't english, so forgive my "bad" english. With the exiftool I analysed a nef-file and found out that the offset of the embedded jpg is at 988672 (length: 996935). So, in Lazarus (object pascal, almost just like Delphi) I've opened the nef, set the filepointer to 988672 and read 996935 bytes.
I presumed that the offset is relative to the beginning of the file. According to the exiftool I needed to swap the bytes (big/little endian). But my image-object in Lazarus says "incorrect image format". So, a few questions:
1. is the offset, the exiftool reported, Always relative to the beginning of the file?
2. is there a possibility the embedded jpg is somehow encrypted?

A workaround I've tried is calling the exiftool with the "-b" option and place the created jpg in a temp-folder. After that I've loaded the jpg with standard Lazarus-objects to display it on my form, but it took too much time to load it (I know, slow harddisk).

Please your advice, I'm a little bit stuck on this problem.

Best regards
Leo

Phil Harvey

Hi Leo,

Quote from: Leo63 on November 05, 2017, 09:11:02 AM
1. is the offset, the exiftool reported, Always relative to the beginning of the file?

Yes.

Quote2. is there a possibility the embedded jpg is somehow encrypted?

No.

But you shouldn't have to do any byte swapping.  Perhaps this is the problem.

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