Homepage: https://www.gnu.org/software/emacs
Author: Lars Magne Ingebrigtsen
Parsing Exif data in JPEG images
Specification at: https://www.media.mit.edu/pia/Research/deepview/exif.html but it's kinda er not very easy to read. The JPEG format is: FFD8 and then any number of chunks on the format: FFxx SSSS ..., where FFxx is the ID, and SSSS is the length of the chunk plus 2. When you get to ID FFDA, the image itself is over and you can stop parsing. The Exif data is in the TIFF format. It starts off with the six bytes "Exif^0^0". Then either "II" or "MM", where "II" means little-endian and "MM" means big-endian. All subsequent numbers should be read in according to this. Next follows two bytes that should always represent 0x2a, and then four bytes that's the offset to where the IFD "image file directory" starts. (It's an offset from the start of this chunk; i.e., where "II"/"MM" is; all offsets in the TIFF format are from this point.) The IFD starts with two bytes that says how many entries there are in the directory, and then that number of entries follows, and then an offset to the next IFD. Usage: (exif-parse-file "test.jpg") => ((:tag 274 :tag-name orientation :format 3 :format-type short :value 1) (:tag 282 :tag-name x-resolution :format 5 :format-type rational :value (180 . 1)) (:tag 306 :tag-name date-time :format 2 :format-type ascii :value "2019:09:21 16:22:13") ...)