Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for data in EXIF format

Tags:

c++

exif

I got the problem with my program made for downloading the DateTimeOrginal data from the .JPG file. I found the document about it on the internet:

https://ExifTool.org/TagNames/EXIF.html

I see that the data I'm looking for is at 0x9003 address.

So right now what I'm trying to do is:

temp = fopen(name, "rb");

open the file binary

fseek (temp, 0x9003, SEEK_SET);

move the File pointer to the address

fscanf(temp, "%s", str);

and load the data to the char[] structure.

Is atleast any of that correct? I'm still thinking that i got the problem with the address, because after compile that program i see only some trash from the file.

like image 247
General_Code Avatar asked Sep 07 '25 01:09

General_Code


1 Answers

The EXIF data is embedded into the jpeg tag APP1 (0xE1).

The first thing to do is to find the jpef tag 0xE1 in the stream; you have to scan all the jpeg tags (marked by 0xFF+tag, in your case 0xFF,0xE1). After you get the tag, find its length by reading the next 2 bytes (and adjust for high endian), then get the tag's content.

After you get the tag's content, then look in it for the EXIF tag you are interested in (0x9003).

The method readStream in the jpeg class of the open source project Imebra gives you an example on how to parse jpeg tags: https://bitbucket.org/binarno/imebra/src/2eb33b2170e76b5ad2737d1c2d81c1dcaccd19e5/project_files/library/imebra/src/jpegCodec.cpp?at=default#cl-867

like image 94
Paolo Brandoli Avatar answered Sep 09 '25 23:09

Paolo Brandoli