Windows users: Jhead has no Graphical User Interface. Clicking on it with the mouse from Windows or Mac OS-X won't do anything for you - you have to use it from the Command prompt (or Dos prompt under Win95/98)
-dt | Delete thumbnails and other extraneous information in the Exif header, but leave the interesting parts intact. This option deletes everything in the exif header after the normally referenced data in the exif header. Exif headers have a built-in thumbnail, which typically occupies around 10k of space. As far as I can tell, this thumbnail is only used by the digital cameras to display several really small thumbnails at a time. The thumbnails are too small to use even full screen on the digicam's LCD. I have not encountered any adverse side effects of deleting the thumbnails, even from the software provided with my old olympus digicam. Use with caution. | ||||||||||||||||||||
-de | Delete the Exif header entirely. This leaves comments in the comment section intact. | ||||||||||||||||||||
-dc | Delete comment field from the JPEG header. Note that the comment is not part of the Exif header. | ||||||||||||||||||||
-ce |
Edit the jpeg hader comment field (note, this comment field is outside the exif structure
and can be part of exif and non exif style Jpeg images).
A temporary file containing the comment is created and Notepad launched to edit it under Windows. Under Unix, vi is used to edit the temprary file. After the file is edited, the comments are put back into the file, and the temporary file is deleted. | ||||||||||||||||||||
-cs <name> | Save comment sectino to a file | ||||||||||||||||||||
-ci <name> | Replace comment with text from file. | ||||||||||||||||||||
-st <name> |
Save the built in thumbnail from jpegs that came from a digital camera. The thumbnail lives
inside the Exif header, and is a very low-res Jpeg image. Note that making
any changes to a photo, except for with some programs, generally wipes out the exif header
and with it the thumbnail.
I implemented this option because I kept getting asked about having such an option. I don't consider the built in thumbnails to be all that useful - too low res. However, now you can see for yourself. I always generate my thumbnails using ImageMagic (see end of this page). This feature has an interesting 'relative path' option for specifying the thumbnail name. Whenever the <name> contains the characters '&i', jhead will substitute the original filename for this name. This allows creating a 'relative name' when doing a whole batch of files. For example, the incantation:
If a '-' is specified for the output file, the thumbnail is sent to stdout. (Unix build only) | ||||||||||||||||||||
-te <name> |
Transplant exif header from image <name> into specified image. This option is
useful if you like to edit the photos but still want the exif header on your photos.
As most photo editing programs will wipe out the exif header, this option can be used
to re-transmplant them back in after editing the photos.
Like the '-st' option, this option uses a 'relative path', which is useful for doing a batch of photos at a time. For example, if you have a directory full of digital camera photos, before editing them, you could copy them into the subdirectory 'originals'. Then edit them (or batch convert them using mogrify). After editing, you can put the original exif headers back in to the whole directory of images at a time using the incantation:
| ||||||||||||||||||||
-h | Displays summary of command line options. | ||||||||||||||||||||
-v | Makes the program even more verbose than it already is. Like dos programs, and unlike Unix programs, Jhead gives feedback as to what it is doing, even when nothing goes wrong. Windows user that I am, when something doesn't give me feedback for 20 seconds, I assume its crashed. | ||||||||||||||||||||
-se | Supress error messages relating to corrupt exif header structure. | ||||||||||||||||||||
-V | Print version info and compilation date. | ||||||||||||||||||||
-c | Concise output. This causes picture info to be summarized on one line instead of several. Useful for grepping through images, as well as importing into spread sheets (data is space delimited with quotes as text qualifier). | ||||||||||||||||||||
-model |
Restricts processing of files to those whose camera model, as indicated by the exif image
information, contains the substring specified in the argument after '-model'.
For example, the following command will list only images that are from an S100 camera:
jhead -model S100 *.jpg
I use this option to restrict my JPEG re-compressing to those images that came from my Cannon S100 digicam, (see the -cmd option).
| ||||||||||||||||||||
-exonly |
Skip all files that don't have an exif header. This skips all files that did not
come directly from the digital camera, as most photo editing software does not
preserve the exif header when saving pictures.
| ||||||||||||||||||||
-n[fmt-string] |
This option causes files to be renamed according to the exif header "DateTimeOriginal" field.
Renaming is restricted to files whose names consist largely of digits.
This effectively restricts renaming to files that have not already been manually renamed, as
the default sequential names from digital cameras consist largely of digits.
Use the -nf option to force renaming of all files.
If the [fmt-string] is omitted, the file will be renamed to MMDD-HHMMSS. Note that
this scheme doesn't include the year (I never have photos from different years together anyway).
Some of the more useful arguments for strftime are:
Example: This will rename files matched by *.jpg according to YYYYMMDD-HHMMSS For a full listing of strftime arguments, look up the strftime function. Note that some arguments to the strftime function (not listed here) produce strings with charactrers such as '/' and ':' that may not be valid as part of a filename on various systems. | ||||||||||||||||||||
-nf |
Same as '-n' but renames files regardless of original file name.
| ||||||||||||||||||||
-ta | Adjust time stored in the exif header by h:mm backwards of forwards. Useful when having taken picutres with the wrong time set on the camera, such as afte travelling across time zones, or when daylight savings time has changed. This option only changes the "DateTimeOriginal" (tar 0x9003) field, but leaves the "DateTimeDigitized" (tag 0x9004) field alone. | ||||||||||||||||||||
-ts |
Sets the time stored in the exif header to what is specified on the command line.
This option only changes the "DateTimeOriginal" (tar 0x9003) field, but leaves the
"DateTimeDigitized" (tag 0x9004) field alone. Time must be specified as: yyyy:mm:dd-hh:mm:ss | ||||||||||||||||||||
-ft | Sets the file's system time stamp to what is stored in the exif header. | ||||||||||||||||||||
-cmd |
Executes the specified command on each Jepg file to be processed. The Exif section of each file is read before running the command, and re-inserted after the command finishes. The specified command invoked separately for each Jpeg that is processed, even if multiple files are specified (explicitly or by wild card). I use this option to process whole directory trees of Jpegs from my digital camera with JPEGTRAN (Independent Jpeg group) and Image-Magic's 'MOGRIFY' command without loosing the camera settings and other info stored in the Exif headers. JPEGTRAN is useful for lossless rotation, as well as for converting Jpegs to progressive Jpegs (also a lossless process, but results in typically 5% smaller files) I use mogrify for re-compressing the images I get from my Canon PowerShot S100 to 80% quality. The Canon Jpegs are either way too 'high quality' for the resolution, or are suboptimally encoded. Using mogrify to 80% produces no detectable loss in quality, with files about half the size.
Example use:
jhead -cmd "jpegtran -progressive &i &o" -r *.jpg
Keeping the Exif header information is important to me, as I like to check things like the shutter speed for some of my photos, and my HTML index generating program uses the exif tags to display the Jpeg images in order of taking. Newer version of "mogrify" already preserve exif informationm, so with some clever shell scripting, you could do these two steps without using jhead and still keep the exif headers.
| ||||||||||||||||||||
-r | The recursive feature of version 1.0 never worked to my satisfaction, and I replaced it with my recursive file globbing code in the Windows version. See below. |
jhead c:\pix\199*\*\*.jpg
This program goes one step beyond beyond that in that "**" as a path component means any level of subdirectories. The invocation
jhead c:\**\*.jpg
will find ALL Jpegs files on the c: drive, including those in the root directory. The ** only works if it is the only part of that path component. For example, the path 'c:\a**\*.jpg' will not recurse. The '**' recursive expansion is ONLY supportedd on the Windows version. The code is in the module 'myglob.c', if you want to reuse it (I certainly intend to reuse that code for other applications). Under Unix, the shell's wildcard expansion is pretty decent already, and dealing with the convoluted nature of some Unix file layouts, doing better would have been much more of a challenge.
Image Magick is one of the few programs that preserves comment and exif headers, although older versions do not.
There's a fancier version, with pre-built Windows binaries and a lossless cropping feature added at: http://sylvana.net/jpegcrop. I have a Compiled Windows Binary of Jpegtran on my website. I got this one by taking the source code for Jpegtran out of the RedHat 6.1 Linux distribution, and compiling it with Microsoft Visual C 5.0.
Jhead homeage: http://www.sentex.net/~mwandel/jhead
Last Updateed: Dec 11 2002