1JHEAD(1)                    General Commands Manual                   JHEAD(1)
2
3
4

NAME

6       jhead - Digicam JPEG Exif header manipulation tool
7

SYNOPSIS

9       jhead [ options ] [ file...  ]
10
11

DESCRIPTION

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

GENERAL METADATA OPTIONS

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 file
101
102

DATE / TIME MANIPULATION OPTIONS

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.  Renaming is
116              by default restricted to files whose names  consist  largely  of
117              digits.   This effectively restricts renaming to files that have
118              not already been manually renamed,  as  the  default  sequential
119              names  from  digital cameras consist largely of digits.  Use the
120              -n option to force renaming of all files.  If the new name  con‐
121              tains  a  '/',  this  will be interpreted as a new path, and the
122              file will be moved accordingly.
123
124              If the format_string is omitted, the file  will  be  renamed  to
125              MMDD-HHMMSS.   Note that this scheme doesn't include the year (I
126              never have photos from different years together anyway).
127
128              If a format_string is provided, it will be passed to  the  strf‐
129              time  function as the format string.  In addition, if the format
130              string contains '%f', this will substitute the original name  of
131              the  file  (minus  extension).   '%i' will substitute a sequence
132              number.  Leading zeros can be specified like with printf -  i.e.
133              '%04i' pads the number to 4 digits using leading zeros.
134
135              If  the name includes '/', this is interpreted as a new path for
136              the file.  If the new path does not exist, the path will be cre‐
137              ated.
138
139              If  the  target  name  already exists, the name will be appended
140              with "a", "b", "c", etc, unless the name ends with a letter,  in
141              which case it will be appended with "0", "1", "2", etc.
142
143              This  feature is especially useful if more than one digital cam‐
144              era was used to take pictures of an event.  By renaming them  to
145              a  scheme  according  to date, they will automatically appear in
146              order of taking in most directory listings and  image  browsers.
147              Alternatively,  if  your  image browser supports listing by file
148              time, you can use the -ft option to set the  file  time  to  the
149              time the photo was taken.
150
151              Some of the more useful arguments for strftime are:
152
153              %H Hour in 24-hour format (00 - 23)
154              %j Day of year as decimal number (001 - 366)
155              %m Month as decimal number (01 - 12)
156              %M Minute as decimal number (00 - 59)
157              %S Second as decimal number (00 - 59)
158              %w Weekday as decimal number (0 - 6; Sunday is 0)
159              %y Year without century, as decimal number (00 - 99)
160              %Y Year with century, as decimal number
161
162              Example:
163
164              jhead -n%Y%m%d-%H%M%S *.jpg
165
166              This  will  rename  files  matched by *.jpg in the format YYYYM‐
167              MDD-HHMMSS
168
169              For a full listing of strftime arguments, look up  the  strftime
170              in  them  man  pages.   Note that some arguments to the strftime
171              function (not listed here) produce strings with characters  such
172              as  ':' that may not be valid as part of a filename on some sys‐
173              tems.
174
175
176       -ta<+|-><timediff>
177              Adjust time stored in the Exif header by h:mm forwards or  back‐
178              wards.   Useful  when  having taken pictures with the wrong time
179              set on the camera, such as after travelling across  time  zones,
180              or when daylight savings time has changed.
181
182              Examples:
183
184              Add 1 hourand 5 minutes to the time
185              jhead -ta+1:05
186
187              Decrease time by one second:
188              jhead -ta-0:0:1
189
190
191              This  option  changes  all  Date/time fields in the exif header,
192              including "DateTimeOriginal"  (tag  0x9003)  and  "DateTimeDigi‐
193              tized" (tag 0x9004).
194
195       -da<newdate>-<olddate>
196
197              Works  like  -ta,  but  for specifying large date offsets, to be
198              used when fixing dates from  cameras  where  the  date  was  set
199              incorrectly,  such  as  having  date  and  time reset by battery
200              removal on some cameras
201
202              Because different months and years  have  different  numbers  of
203              days in them, a simple offset for months, days, years would lead
204              to unexpected results at times.  The time offset is thus  speci‐
205              fied as a difference between two dates, so that jhead can figure
206              out exactly how many days the timestamp needs to be adjusted by,
207              including  leap  years  and  daylight savings time changes.  The
208              dates are specified as yyyy:mm:dd.  For sub-day  adjustments,  a
209              time of day can also be included, by specifying yyyy:nn:dd/hh:mm
210              or yyyy:mm:dd/hh:mm:ss
211
212              Examples:
213
214              Year on camera was set to 2005  instead  of  2004  for  pictures
215              taken in April
216              jhead -da2004:03:01-2005:03:01
217
218              Default  camera  date  is  2002:01:01,  and  date  was  reset on
219              2005:05:29 at 11:21 am
220              jhead -da2005:05:29/11:21-2002:01:01
221
222       -ts    Sets the time stored in the Exif header to what is specified  on
223              the    command    line.     Time    must    be   specified   as:
224              yyyy:mm:dd-hh:mm:ss
225
226       -ds    Sets the date stored in the Exif header to what is specified  on
227              the command line.  Can be used to set date, just year and month,
228              or just year.  Date is specified  as:  yyyy:mm:dd,  yyyy:mm,  or
229              yyyy
230
231

THUMBNAIL MANIPULATION OPTIONS

233       -dt    Delete  thumbnails from the Exif header, but leave the interest‐
234              ing parts intact.  This option truncates the thumbnail from  the
235              Exif header, provided that the thumbnail is the last part of the
236              Exif header (which so far as I know is always the  case).   Exif
237              headers  have  a  built-in  thumbnail,  which typically occupies
238              around 10k of space.  This thumbnail is used by digital cameras.
239              Windows  XP  may  also  use  this  thumbnail  if present (but it
240              doesn't need it).  The thumbnails are too small to use even full
241              screen on the digicam's LCD.  I have not encountered any adverse
242              side effects of deleting the thumbnails, even from the  software
243              provided with my old Olympus digicam.  Use with caution.
244
245
246       -st file
247              Save  the  integral thumbnail to file The thumbnail lives inside
248              the Exif header, and is a very low-res JPEG  image.   Note  that
249              making  any  changes  to a photo, except for with some programs,
250              generally wipes out the Exif header and with it the thumbnail.
251
252              The thumbnail is too low res to really use for very much.
253
254              This feature has an interesting 'relative path' option for spec‐
255              ifying  the thumbnail name.  Whenever the name for file contains
256              the characters  '&i', jhead will substitute the  original  file‐
257              name for this name.  This allows creating a 'relative name' when
258              doing a whole batch of files.  For example, the incantation:
259
260              jhead -st "thumbnails/&i" *.jpg
261
262              would create a thumbnail for each .jpg file  in  the  thumbnails
263              directory by the same name, (provided that the thumbnails direc‐
264              tory exists, of course).  Both Win32 and UNIX shells  treat  the
265              '&'character  in a special way, so you have to put quotes around
266              that command line option for the '&' to even be  passed  to  the
267              program.
268
269              If a '-' is specified for the output file, the thumbnail is sent
270              to stdout. (UNIX build only)
271
272
273       -rt    Replace thumbnails from the Exif header.  This only works if the
274              exif  header  already contains a thumbnail, and the thumbnail is
275              at the end of the header (both always the case if the photo came
276              from a digital camera)
277
278       -rgt size
279              Regenerate  exif  thumbnail.  'size' specifies maximum height or
280              width of thumbnail.  Relies on 'mogrify' program (from ImageMag‐
281              ick)  to regenerate the thumbnail.  This only works if the image
282              already contains a thumbnail.
283
284

ROTATION OPTIONS

286       -autorot
287              Using the 'Orientation' tag of the Exif header, rotate the image
288              so  that it is upright.  The program jpegtran is used to perform
289              the rotation. This program is present in  most  Linux  distribu‐
290              tions.   For windows, you need to get a copy of it.  After rota‐
291              tion, the orientation tag of the Exif header is set to '1' (nor‐
292              mal  orientation).   The thumbnail is also rotated. Other fields
293              of the Exif header, including dimensions are untouched, but  the
294              JPEG height/width are adjusted.  This feature is especially use‐
295              ful with newer Canon cameras, that set the orientation tag auto‐
296              matically using a gravity sensor.
297
298       -norot Clears  the  rotation  field in the Exif header without altering
299              the image.  Useful if the images were previously rotated without
300              clearing the Exif rotation tag, as some image browsers will auto
301              rotate images when the rotation tag is set.   Sometimes,  thumb‐
302              nails and rotation  tags can get very out of sync from manipula‐
303              tion with various tools.  To reset it all use -norot  with  -rgt
304              to clear this out.
305
306

OUTPUT VERBOSITY CONTROL

308       -h     Displays summary of command line options.
309
310       -v     Makes  the  program  even more verbose than it already is.  Like
311              DOS programs, and unlike UNIX programs, Jhead gives feedback  as
312              to what it is doing, even when nothing goes wrong.  Windows user
313              that I am, when something doesn't give me feedback for  20  sec‐
314              onds, I assume its crashed.
315
316       -q     No output on success, more like Unix programs.
317
318       -V     Print version info and compilation date.  -exifmap Show a map of
319              the bytes in the exif header. Useful when analyzing strange exif
320              headers, not of much use to non software developers.
321
322       -se    Suppress  error  messages relating to corrupt Exif header struc‐
323              ture.
324
325       -c     Concise output.  This causes picture info to  be  summarized  on
326              one  line  instead  of  several.   Useful  for  grep-ing through
327              images, as well as importing into spread sheets (data  is  space
328              delimited with quotes as text qualifier).
329
330

FILE MATCHING OPTIONS

332       -model Restricts  processing  of  files to those whose camera model, as
333              indicated by the Exif image information, contains the  substring
334              specified in the argument after '-model'.  For example, the fol‐
335              lowing command will list only images that are from an S100  cam‐
336              era:
337
338              jhead -model S100 *.jpg
339
340              I  use  this  option  to  restrict my JPEG recompensing to those
341              images that came from my  Canon  S100  digicam,  (see  the  -cmd
342              option).
343
344       -exonly
345              Skip  all files that don't have an Exif header.  Photos straight
346              from a digital camera have an Exif header,  whereas  many  photo
347              manipulation tools discard the Exif header.
348
349       -cmd   Executes  the  specified  command  on  each JPEG file to be pro‐
350              cessed.
351
352              The Exif section of each file is read before  running  the  com‐
353              mand, and reinserted after the command finishes.
354
355              The  specified  command invoked separately for each JPEG that is
356              processed, even if multiple files are specified  (explicitly  or
357              by wild card).
358
359              Example use:
360
361              Having  a whole directory of photos from my S100, I run the fol‐
362              lowing commands:
363
364              jhead -cmd "mogrify -quality 80 &i" -model S100 *.jpg
365              jhead -cmd "jpegtran -progressive &i > &o" *.jpg
366
367              The first command mogrifies all JPEGs in the tree that  indicate
368              that  they  are  from  a  Canon S100 in their Exif header to 80%
369              quality at the same resolution.  This is a 'lossy' process, so I
370              only  run  it  on files that are from the Canon, and only run it
371              once.  The next command then takes a JPEGs and converts them  to
372              progressive  JPEGs.  The result is the same images, with no dis‐
373              cernible differences, stored in half the space.   This  produces
374              substantial savings on some cameras.
375
376

SEE ALSO

378       jpegtran(1), mogrify(1), rdjpgcom(1), wrjpgcom(1)
379

AUTHOR

381       Matthias Wandel
382

BUGS

384       After  jhead  runs  a  program  to rotate or resize an image, the image
385       dimensions and thumbnail in the Exif header are not adjusted.
386
387       Modifying of Exif header data is very limited, as Jhead internally only
388       has a read only implementation of the file system contained in the Exif
389       header.  For example, there is no way to replace the thumbnail or  edit
390       the  Exif  comment  in the Exif header.  There is also no way to create
391       minimal exif headers.
392
393       Some Canon digital SLR cameras fail to adjust the effective sensor res‐
394       olution  when  shooting  at less than full resolution, causing jhead to
395       incorrectly miscalculate the sensor width  and  35mm  equivalent  focal
396       length.  The same can result from resizing photos with Photoshop, which
397       will manipulate parts of the exif header.  This is often reported as  a
398       bug in Jhead, but Jhead can't do much about incorrect data.
399
400       Send bug reports to mwandel at sentex dot net.
401
402

COPYING PERMISSIONS

404       Jhead is 'public domain'.  You may freely copy jhead, and reuse part or
405       all of its code in free or proprietary programs.   I do however request
406       that  you  do  not  post my e-mail address in ways that spam robots can
407       harvest it.
408
409
410
411jhead 3.03                        11 Dec 2018                         JHEAD(1)
Impressum