Software |
exifcleaner | |
exifcleaner will make Exif image files smaller by removing both any
MakerNote section and any blank sections in the files.
| |
Do not use this program. Use ExifTool by Phil Harvey instead!
Since I wrote this in 2004 and 2005 things have changed, and there now are much better tools available. I just keep this online for reference purposes, and if someone wants to see an early implementation of EXIF manipulation code. It has severe endian problems, and probably won't work on little-endian computers, so be very careful!
Using | |
Most digital still cameras save the pictures in the Exif file format. Exif
is an extension to the JPEG file format, that makes it possible to store
metadata about the picture, like the date and time the picture was taken
and all the settings that the camera used. Some data fields are
standardized, like aperture value, shutter time, focal length, whether the
flash fired etc, but it also is possible for the camera maker to store
values that are not part of the standard in a special "MakerNote" section.
The MakerNote sections from different cameras usually are between 400 and 1600 bytes in length, but some cameras have MakerNote sections in the 25,000 to 55,000 byte range. The larger MakerNotes often contain a whole JPEG picture for preview purposes, with lower resolution than the main image, but larger than the Exif integral thumbnail that is present too. Also, files from some cameras have several kilobytes of blank sections (consisting of NUL characters) in them that are totally a waste of space. When publishing digicam pictures on the web, downscaled to 500 or 600 pixels in width, and with image file sizes of 20 to 60 kbytes, it feels quite silly to keep a metadata section in the file that even may be larger than the image data itself. Large MakerNotes is of no use to the web page visitors and it just makes download times longer. At the same time it may be desired to keep the basic metadata such as timestamp, aperture, shutter time etc. This program will remove the MakerNote section and the blank sections from the files while keeping the rest of the Exif data, saving up to 55 kbytes depending on camera model. Another reason for reducing the Exif data size is if you're using Apple iPhoto version 5 and experience that the program takes a long time both to start and to exit. Apparently, iPhoto 5 stores the Exif data, including the MakerNote and any blank sections, from all your photos into one single combined file called "Library.iPhoto". If you have say 6000 photos, and each has a 40KB MakerNote included, this makes "Library.iPhoto" expand to over 250MB. A solution to this is to strip the MakerNote before importing the images into iPhoto. Unfortunately it doesn't seem possible to erase the MakerNote after the image already is imported. Note that while removing the blank sections doesn't make you lose anything, removing the MakerNotes actually has the effect that you lose some of your camera's proprietary metadata. The MakerNote section typically contains settings like digital zoom ratio, autofocus position, sharpening etc, that will be lost after processing. Use it only on copies of your files, for example when preparing them for web publishing.
Also note that this software may not work with your images. Each
camera model stores the meta data and the image data a little bit
differently, and the files may contain sections that the program can't
handle. Photo editing software and camera-to-computer image transfer
programs can also alter the structure of the files and insert unexpected
data fields. Removal is done "in place" i.e. the original file will be
replaced with the edited version. Back up important files first.
| |
Download current version | |
exifcleaner has been reported to corrupt image files on some computers. I have not fully investigated when this happens, but I suspect it is an endianness issue. I have sucessfully run exifcleaner on big-endian platforms like MacOSX on PowerPC and Solaris on SPARC, but have had image files thrashed on a little-endian computer (Linux on x86). Only use exifcleaner on copies of your files. | |
Installation | |
Copy the file to a suitable directory, for example /usr/local/bin
or somewhere in your own home directory. On some systems, it may be needed
to rename it with a .pl extension, too.
Change the first line of the program to point to your own copy of Perl. /usr/local/bin/perl is common, and so is /usr/bin/perl (you probably can find out where your machine has it by typing whereis perl or which perl
To give the program execute permissions, type chmod 755 exifcleaner
| |
Usage | |
The program is run from the command line in a Unix/Linux shell, the
Terminal in MacOS X or similar.
exifcleaner [options] files
| |
Tested cameras | |
Canon EOS 10D.JPG | 1474 bytes removed. |
Canon EOS 300D | 1464 bytes removed. |
Canon Digital IXUS | 689 bytes removed. |
Canon Digital IXUS 400 | 1193 bytes removed. |
Canon Digital IXUS i | 1315 bytes removed. |
Canon Digital IXUS v | 771 bytes removed. |
Minolta DiMAGE Z1 | 49293 bytes removed. |
Nikon D70 | 26396 bytes removed. |
Nikon D100 | 25017 bytes removed. |
Olympus Camedia C-2020 Z | 3276 bytes removed. |
Olympus Camedia C-5060 WZ | 7979 bytes removed. |
Olympus Camedia C-60 Z | 7191 bytes removed. |
Olympus Camedia D-307 | 1668 bytes removed. |
Pentax *ist D | 55317 bytes removed. |
Pentax Optio MX4 | 49172 bytes removed. |
Pentax Optio S | 27902 bytes removed. |
Pentax Optio WPi | 40k to 50k bytes removed. |
SonyEricsson K750 | 30 bytes removed. |
Sony DSC-P43 | 1578 bytes removed. |
Sony DSC-U10 | 20--45 bytes removed. |
Sony DSC-U20 | 19 bytes removed. |
Sony DSC-U30 | 1588 bytes removed. |
Version history | |
| |
Possible future development | |
There are currently no plans to develop this program further.
If someone wants to, feel free! The most important issue would be to fix the endianness problem.
Another known issue is that the program won't deal well with files that have more SubIFD:s than the ones that I've encountered so far. It handles IFD0 and IFD1, the Exif SubIFD (of course) and the InterOperability SubIFD, and it discards the whole MakerNote regardless of what it contains. If a file should contain more SubIFD:s, for instance one with GPS data or linked audio, the program would discard them too -- but leave the offset unalteted, possibly leading to malfunction in a Exif reader that tried to read those data fields. Now that files with GPS data have become common, a new version should probably deal with them. A possible future development would be to analyse the MakerNote and try to keep any metadata settings in it while discarding the big JPEG:s that are the real problem. Some MakerNotes have SubIFD:s in them too, and those could be kept, but since the MakerNote differs between each camera model and there aren't any official documentation for them, that would be a hard thing to do in a sufficently general manner. A line of development that lies outside of the intended use of this program, but may be worth mentioning, is to not only copy the Exif data fields but to insert new values. Since all Exif data fields are read into memory and then written back to the new file, it would be possible to alter the contents of some or all of the data fields at will, or to create new data fields that the original lacked. It would also be possible to use the part of the program that writes the Exif data to disk in a new program that adds an Exif structure to JPEG files that don't have any metadata at all to begin with. Most of these use cases are covered by either jhead or exiftool though.
| |
System requirements | |
|