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