1JHEAD(1) General Commands Manual JHEAD(1)
2
3
4
6 jhead - Digicam JPEG Exif header manipulation tool
7
9 jhead [ options ] [ file... ]
10
11
13 jhead is used to display and manipulate data contained in the Exif
14 header of JPEG images from digital cameras. By default, jhead displays
15 the more useful camera settings from the file in a user-friendly for‐
16 mat.
17
18 jhead can also be used to manipulate some aspects of the image relating
19 to JPEG and Exif headers, such as changing the internal timestamps,
20 removing the thumbnail, or transferring Exif headers back into edited
21 images after graphical editors deleted the Exif header. jhead can also
22 be used to launch other programs, similar in style to the UNIX find
23 command, but much simpler.
24
25
26
28 -te file
29 Transplant Exif header from a JPEG (with Exif header) in file
30 into the image that is manipulated. This option is useful if
31 you like to edit the photos but still want the Exif header on
32 your photos. As most photo editing programs will wipe out the
33 Exif header, this option can be used to re-copy them back from
34 original copies after editing the photos.
35
36
37 This feature has an interesting 'relative path' option for spec‐
38 ifying the thumbnail name. Whenever the <name> contains the
39 characters '&i', will substitute the original filename for this
40 name. This allows creating a jhead 'relative name' when doing a
41 whole batch of files. For example, the incantation:
42
43 jhead -te originals/&i *.jpg
44
45 would transfer the exif header for each .jpg file in the origi‐
46 nals directory by the same name, Both Win32 and most Unix shells
47 treat the command line option for the '&' to even be passed to
48 the program.
49
50
51 -dc Delete comment field from the JPEG header. Note that the com‐
52 ment is not part of the Exif header.
53
54 -de Delete the Exif header entirely. Leaves other metadata sections
55 intact.
56
57 -di Delete the IPTC section, if present. Leaves other metadata sec‐
58 tions intact.
59
60 -dx Delete the XMP section, if present. Leaves other metadata sec‐
61 tions intact.
62
63 -du Delete sections of jpeg that are not Exif, not comment, and oth‐
64 erwise not contributing to the image either - such as data that
65 photoshop might leave in the image.
66
67 -purejpg
68 Delete all JPEG sections that aren't necessary for rendering the
69 image. Strips any metadata that various applications may have
70 left in the image. A combination of the -de -dc and -du
71 options.
72
73 -mkexif
74 Creates minimal exif header. Exif header contains date/time, and
75 empty thumbnail fields only. Date/time set to file time by
76 default. Use with -rgt option if you want the exif header to
77 contain a thumbnail. Note that exif header creation is very lim‐
78 ited at this time, and no other fields can be added to the exif
79 header this way.
80
81 -ce Edit the JPEG header comment field (note, this comment field is
82 outside the Exif structure and can be part of Exif and non Exif
83 style JPEG images).
84
85 A temporary file containing the comment is created and a text
86 editor is launched to edit the file. The editor is specified in
87 the EDITOR environment variable. If none is specified notepad
88 or vi are used under Windows and Unix respectively. After the
89 editor exits, the data is transferred back into the image, and
90 the temporary file deleted.
91
92 -cs file
93 Save comment section to a file
94
95 -ci file
96 Replace comment with text from file
97
98 -cl string
99 Replace comment with specified string from command line file
100
101
103 -ft Sets the file's system time stamp to what is stored in the Exif
104 header.
105
106 -dsft Sets the Exif timestamp to the file's timestamp. Requires an
107 Exif header to pre-exist. Use -mkexif option to create one if
108 needed.
109
110 -n[format_string]
111 This option causes files to be renamed and/ or mmoved using the
112 date information from the Exif header "DateTimeOriginal" field.
113 If the file is not an Exif file, or the DateTimeOriginal does
114 not contain a valid value, the file date is used. Renaming is
115 by default restricted to files whose names consist largely of
116 digits. This effectively restricts renaming to files that have
117 not already been manually renamed, as the default sequential
118 names from digital cameras consist largely of digits. Use the
119 -nf option to force renaming of all files. If the new name con‐
120 tains a '/', this will be interpreted as a new path, and the
121 file will be moved accordingly.
122
123 If the format_string is omitted, the file will be renamed to
124 MMDD-HHMMSS. Note that this scheme doesn't include the year (I
125 never have photos from different years together anyway).
126
127 If a format_string is provided, it will be passed to the strf‐
128 time function as the format string. In addition, if the format
129 string contains '%f', this will substitute the original name of
130 the file (minus extension). '%i' will substitute a sequence
131 number. Leading zeros can be specified like with printf - i.e.
132 '%04i' pads the number to 4 digits using leading zeros.
133
134 If the name includes '/', this is interpreted as a new path for
135 the file. If the new path does not exist, the path will be cre‐
136 ated.
137
138 If the target name already exists, the name will be appended
139 with "a", "b", "c", etc, unless the name ends with a letter, in
140 which case it will be appended with "0", "1", "2", etc.
141
142 This feature is especially useful if more than one digital cam‐
143 era was used to take pictures of an event. By renaming them to
144 a scheme according to date, they will automatically appear in
145 order of taking in most directory listings and image browsers.
146 Alternatively, if your image browser supports listing by file
147 time, you can use the -ft option to set the file time to the
148 time the photo was taken.
149
150 Some of the more useful arguments for strftime are:
151
152 %H Hour in 24-hour format (00 - 23)
153 %j Day of year as decimal number (001 - 366)
154 %m Month as decimal number (01 - 12)
155 %M Minute as decimal number (00 - 59)
156 %S Second as decimal number (00 - 59)
157 %w Weekday as decimal number (0 - 6; Sunday is 0)
158 %y Year without century, as decimal number (00 - 99)
159 %Y Year with century, as decimal number
160
161 Example:
162
163 jhead -n%Y%m%d-%H%M%S *.jpg This will rename files matched by
164 *.jpg in the format YYYYMMDD-HHMMSS
165
166 For a full listing of strftime arguments, look up the strftime
167 in them man pages. Note that some arguments to the strftime
168 function (not listed here) produce strings with characters such
169 as ':' that may not be valid as part of a filename on some sys‐
170 tems.
171
172
173 -nf Same as '-n' but renames files regardless of original file name.
174
175
176
177 -ta<+|-><timediff>
178 Adjust time stored in the Exif header by h:mm backwards or for‐
179 wards. Useful when having taken pictures with the wrong time
180 set on the camera, such as after travelling across time zones,
181 or when daylight savings time has changed.
182
183 This option changes all Date/time fields in the exif header,
184 including "DateTimeOriginal" (tag 0x9003) and "DateTimeDigi‐
185 tized" (tag 0x9004).
186
187 -da<newdate>-<olddate>
188
189 Works like -ta, but for specifying large date offsets, to be
190 used when fixing dates from cameras where the date was set
191 incorrectly, such as having date and time reset by battery
192 removal on some cameras
193
194 Because different months and years have different numbers of
195 days in them, a simple offset for months, days, years would lead
196 to unexpected results at times. The time offset is thus speci‐
197 fied as a difference between two dates, so that jhead can figure
198 out exactly how many days the timestamp needs to be adjusted by,
199 including leap years and daylight savings time changes. The
200 dates are specified as yyyy:mm:dd. For sub-day adjustments, a
201 time of day can also be included, by specifying yyyy:nn:dd/hh:mm
202 or yyyy:mm:dd/hh:mm:ss
203
204 Examples:
205
206 Year on camera was set to 2005 instead of 2004 for pictures
207 taken in April
208 jhead -da2004:03:01-2005:03:01
209
210 Default camera date is 2002:01:01, and date was reset on
211 2005:05:29 at 11:21 am
212 jhead -da2005:05:29/11:21-2002:01:01
213
214 -ts Sets the time stored in the Exif header to what is specified on
215 the command line. Time must be specified as:
216 yyyy:mm:dd-hh:mm:ss
217
218 -ds Sets the date stored in the Exif header to what is specified on
219 the command line. Can be used to set date, just year and month,
220 or just year. Date is specified as: yyyy:mm:dd, yyyy:mm, or
221 yyyy
222
223
225 -dt Delete thumbnails from the Exif header, but leave the interest‐
226 ing parts intact. This option truncates the thumbnail from the
227 Exif header, provided that the thumbnail is the last part of the
228 Exif header (which so far as I know is always the case). Exif
229 headers have a built-in thumbnail, which typically occupies
230 around 10k of space. This thumbnail is used by digital cameras.
231 Windows XP may also use this thumbnail if present (but it
232 doesn't need it). The thumbnails are too small to use even full
233 screen on the digicam's LCD. I have not encountered any adverse
234 side effects of deleting the thumbnails, even from the software
235 provided with my old Olympus digicam. Use with caution.
236
237
238 -st file
239 Save the integral thumbnail to file The thumbnail lives inside
240 the Exif header, and is a very low-res JPEG image. Note that
241 making any changes to a photo, except for with some programs,
242 generally wipes out the Exif header and with it the thumbnail.
243
244 The thumbnail is too low res to really use for very much.
245
246 This feature has an interesting 'relative path' option for spec‐
247 ifying the thumbnail name. Whenever the name for file contains
248 the characters '&i', jhead will substitute the original file‐
249 name for this name. This allows creating a 'relative name' when
250 doing a whole batch of files. For example, the incantation:
251
252 jhead -st thumbnails/&i *.jpg
253
254 would create a thumbnail for each .jpg file in the thumbnails
255 directory by the same name, (provided that the thumbnails direc‐
256 tory exists, of course). Both Win32 and UNIX shells treat the
257 '&'character in a special way, so you have to put quotes around
258 that command line option for the
259
260 If a '-' is specified for the output file, the thumbnail is sent
261 to stdout. (UNIX build only)
262
263
264 -rt Replace thumbnails from the Exif header. This only works if the
265 exif header already contains a thumbnail, and the thumbnail is
266 at the end of the header (both always the case if the photo came
267 from a digital camera)
268
269 -rgt size
270 Regenerate exif thumbnail. 'size' specifies maximum height or
271 width of thumbnail. Relies on 'mogrify' program (from ImageMag‐
272 ick) to regenerate the thumbnail. This only works if the image
273 already contains a thumbnail.
274
275
277 -autorot
278 Using the 'Orientation' tag of the Exif header, rotate the image
279 so that it is upright. The program jpegtran is used to perform
280 the rotation. This program is present in most Linux distribu‐
281 tions. For windows, you need to get a copy of it. After rota‐
282 tion, the orientation tag of the Exif header is set to '1' (nor‐
283 mal orientation). The thumbnail is also rotated. Other fields
284 of the Exif header, including dimensions are untouched, but the
285 JPEG height/width are adjusted. This feature is especially use‐
286 ful with newer Canon cameras, that set the orientation tag auto‐
287 matically using a gravity sensor.
288
289 -norot Clears the rotation field in the Exif header without altering
290 the image. Useful if the images were previously rotated without
291 clearing the Exif rotation tag, as some image browsers will auto
292 rotate images when the rotation tag is set. Sometimes, thumb‐
293 nails and rotation tags can get very out of sync from manipula‐
294 tion with various tools. To reset it all use -norot with -rgt
295 to clear this out.
296
297
299 -h Displays summary of command line options.
300
301 -v Makes the program even more verbose than it already is. Like
302 DOS programs, and unlike UNIX programs, Jhead gives feedback as
303 to what it is doing, even when nothing goes wrong. Windows user
304 that I am, when something doesn't give me feedback for 20 sec‐
305 onds, I assume its crashed.
306
307 -q No output on success, more like Unix programs.
308
309 -V Print version info and compilation date. -exifmap Show a map of
310 the bytes in the exif header. Useful when analyzing strange exif
311 headers, not of much use to non software developers.
312
313 -se Suppress error messages relating to corrupt Exif header struc‐
314 ture.
315
316 -c Concise output. This causes picture info to be summarized on
317 one line instead of several. Useful for grep-ing through
318 images, as well as importing into spread sheets (data is space
319 delimited with quotes as text qualifier).
320
321
323 -model Restricts processing of files to those whose camera model, as
324 indicated by the Exif image information, contains the substring
325 specified in the argument after '-model'. For example, the fol‐
326 lowing command will list only images that are from an S100 cam‐
327 era:
328
329 jhead -model S100 *.jpg
330
331 jhead -model S100 *.jpg
332
333 I use this option to restrict my JPEG recompensing to those
334 images that came from my Canon S100 digicam, (see the -cmd
335 option).
336
337 -exonly
338 Skip all files that don't have an Exif header. Photos straight
339 from a digital camera have an Exif header, whereas many photo
340 manipulation tools discard the Exif header.
341
342 -cmd Executes the specified command on each JPEG file to be pro‐
343 cessed.
344
345 The Exif section of each file is read before running the com‐
346 mand, and reinserted after the command finishes.
347
348 The specified command invoked separately for each JPEG that is
349 processed, even if multiple files are specified (explicitly or
350 by wild card).
351
352 Example use:
353
354 Having a whole directory of photos from my S100, I run the fol‐
355 lowing commands:
356
357 jhead -cmd mogrify -quality 80 &i -model S100 -r *.jpg
358 jhead -cmd jpegtran -progressive &i > &o -r *.jpg
359
360 The first command mogrifies all JPEGs in the tree that indicate
361 that they are from a Canon S100 in their Exif header to 80%
362 quality at the same resolution. This is a 'lossy' process, so I
363 only run it on files that are from the Canon, and only run it
364 once. The next command then takes a JPEGs and converts them to
365 progressive JPEGs. The result is the same images, with no dis‐
366 cernible differences, stored in half the space. This produces
367 substantial savings on some cameras.
368
369
371 jpegtran(1), mogrify(1), rdjpgcom(1), wrjpgcom(1)
372
374 Matthias Wandel
375
377 After jhead runs a program to rotate or resize an image, the image
378 dimensions and thumbnail in the Exif header are not adjusted.
379
380 Modifying of Exif header data is very limited, as Jhead internally only
381 has a read only implementation of the file system contained in the Exif
382 header. For example, there is no way to replace the thumbnail or edit
383 the Exif comment in the Exif header. There is also no way to create
384 minimal exif headers.
385
386 Some Canon digital SLR cameras fail to adjust the effective sensor res‐
387 olution when shooting at less than full resolution, causing jhead to
388 incorrectly miscalculate the sensor width and 35mm equivalent focal
389 length. The same can result from resizing photos with Photoshop, which
390 will manipulate parts of the exif header. This is often reported as a
391 bug in Jhead, but Jhead can't do much about incorrect data.
392
393 Send bug reports to mwandel at sentex dot net.
394
395
397 Jhead is 'public domain'. You may freely copy jhead, and reuse part or
398 all of its code in free or proprietary programs. I do however request
399 that you do not post my e-mail address in ways that spam robots can
400 harvest it.
401
402
403
404jhead 2.90 05 Feb 2010 JHEAD(1)