I recently embarked on this C project. The code below does the following:
1) Returns the current image orientation.
2) Deletes all data contained in APP1 (Exif data) and APP2 (Flashpix data) by blanking.
3) Restores the orientation marker APP1 and sets it to its original value.
4) Find the first EOI marker (Image End) and crop the file if nessasary.
First of all, the following should be noted:
1) This program is used for my Nikon camera. The Nikon JPEG format adds to the very end of each file you create. They encode this data to the end of the image file, creating a second EOI token. Typically, image programs are read before the first EOI marker. After that, Nikon has information that my program truncates.
2) Since this is a Nikon format, it accepts a big endian byte order. If your image file uses little endian , some changes need to be made.
3) When I tried to use ImageMagick to delete exif data, I noticed that I got a larger file than I started. This makes me think that ImageMagick encodes the data you want to delete and stores it somewhere else in the file. Call me old-fashioned, but when I delete something from the file, I want the file size to be smaller, if not the same size. Any other results require data mining.
And here is the code:
#include <stdio.h>
Hope this helps someone!
Deanie Oct 27 '16 at 10:23 2016-10-27 22:23
source share