Is there an easy way to determine if there is EXIF data in a file?
Is there any cheap and reliable way to determine if the EXIF image file contains data? Something like "read first 100 bytes and search for EXIF substring" is highly preferred. I don't need to read and disassemble it - just know if it exists.
The key is that it has to be very fast. C ++ is preferred.
source to share
You can read the source extension EXIF DATA the PHP - see how to implement exif_read_data, you can find some clues.
source to share
If you don't need more performance, I would use some Exif library and try to get the Exif data (if any) for you. (pyexif, perl Image :: exif, C # MetaDataExtractor, etc.)
Otherwise
take a look at http://en.wikipedia.org/wiki/JPEG#Syntax_and_structure
You need to create a simple binary parser to dig up the "segment codes" and find a segment called APP1 (if I understand it correctly). Data must contain the letters "Exif"
eg. in a random JPEG file on my PC, bytes 7-10 said "Exif". I don't know if the location is the same across all JPEG files. Segments can be of variable length.
source to share