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', jhead will substitute  the  original   filename
40              for this name. This allows creating a incantation:
41
42              jhead -te originalsi *.jpg
43
44              would  transfer the exif header for each .jpg file in the origi‐
45              nals directory by the same name, Both Win32 and most Unix shells
46              treat  the  '&'  character  in a special way, so you have to put
47              quotes around that command line option for the
48
49
50       -dc    Delete comment field from the JPEG header.  Note that  the  com‐
51              ment is not part of the Exif header.
52
53       -de    Delete the Exif header entirely.  Leaves other metadata sections
54              intact.
55
56       -di    Delete the IPTC section, if preent.  Leaves other metadata  sec‐
57              tions intact.
58
59       -dx    Delete  the  XMP section, if preent.  Leaves other metadata sec‐
60              tions intact.
61
62       -du    Delete sections of jpeg that are not Exif, not comment, and oth‐
63              erwise  not contributing to the image either - such as data that
64              photoshop might leave in the image.
65
66       -purejpg
67              Delete all JPEG sections that aren't necessary for rendering the
68              image.   Strips  any metadata that various applications may have
69              left in the image.  A combintion of the -de -dc and -du options.
70
71       -mkexif
72              Creates minimal exif header. Exif header contains date/time, and
73              empty  thumbnail  fields  only.  Date/time  set  to file time by
74              default. use with -rgt option if you want  the  exif  header  to
75              contain a thumbnail. Note that exif header creation is very lim‐
76              ited at this time, and no other fields can be added to the  exif
77              header this way.
78
79       -ce    Edit  the JPEG header comment field (note, this comment field is
80              outside the Exif structure and can be part of Exif and non  Exif
81              style JPEG images).
82
83              A  temporary  file  containing the comment is created and a text
84              editor is launched to edit the file.  The editor is specified in
85              the  EDITOR  environment variable.  if none is specified notpead
86              or vi are used under Windows and Unix respectively.   After  the
87              editor  exits,  the data is transferred back into the image, and
88              the temporary file deleted.
89
90       -cs file
91              Save comment section to a file
92
93       -ci file
94              Replace comment with text from file
95
96       -cl string
97              Replace comment with specified string from command line file
98
99
100
101

DATE / TIME MANIPULATION OPTIONS

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

THUMBNAIL MANIPULATION OPTIONS

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

ROTATION OPTIONS

272       -autorot
273              Using the 'Orientation' tag of the Exif header, rotate the image
274              so  that it is upright.  The program jpegtran is used to perform
275              the rotation. This program is present in  most  Linux  distribu‐
276              tions.   For windows, you need to get a copy of it.  After rota‐
277              tion, the orientation tag of the Exif header is set to '1' (nor‐
278              mal  orientation).   The thumbnail is also rotated. Other fields
279              of the Exif header, including dimensions are untouched, but  the
280              JPEG height/width are adjusted.  This feature is especially use‐
281              ful with newer Canon cameras, that set the orientation tag auto‐
282              matically using a gravity sensor.
283
284       -norot Clears  the  rotation  field in the Exif header without altering
285              the image.  Useful if the images were previously rotated without
286              clearing the Exif rotation tag, as some image browsers will auto
287              rotate images when the rotation tag is  set.   Sometimes,  thun‐
288              bails and rotation  tags can get very out of sync from manipula‐
289              tion with various tools.  To reset it all use -norot  with  -rgt
290              to clear this out.
291
292

OUTPUT VERBOSITY CONTROL

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

FILE MATCHING OPTIONS

318       -model Restricts  processing  of  files to those whose camera model, as
319              indicated by the Exif image information, contains the  substring
320              specified in the argument after '-model'.  For example, the fol‐
321              lowing command will list only images that are from an S100  cam‐
322              era:
323
324              jhead -model S100 *.jpg
325
326              jhead -model S100 *.jpg
327
328              I  use  this  option  to  restrict my JPEG recompensing to those
329              images that came from my Cannon  S100  digicam,  (see  the  -cmd
330              option).
331
332       -exonly
333              Skip  all files that don't have an Exif header.  Photos straight
334              from a digital camera have an Exif header,  whereas  many  photo
335              manipulation tools discard the Exif header.
336
337       -cmd   Executes  the  specified  command  on  each Jepg file to be pro‐
338              cessed.
339
340              The Exif section of each file is read before  running  the  com‐
341              mand, and reinserted after the command finishes.
342
343              The  specified  command invoked separately for each JPEG that is
344              processed, even if multiple files are specified  (explicitly  or
345              by  wild  card).   I  use this option to process whole directory
346              trees of JPEGs from my digital camera with jpegtran (Independent
347              JPEG  group) and ImageMagick's 'MOGRIFY' command without loosing
348              the camera settings and other info stored in the Exif headers.
349
350              jpegtran is useful for lossless rotation, as well  as  for  con‐
351              verting JPEGs to progressive JPEGs (also a lossless process, but
352              results in typically 5% smaller files) I use mogrify for re-com‐
353              pressing  the  images  I get from my Canon PowerShot S100 to 80%
354              quality.  The Canon JPEGs are either way too 'high quality'  for
355              the  resolution,  or are suboptimally encoded.  Using mogrify to
356              80% produces no detectable loss in  quality,  with  files  about
357              half the size.
358
359              Example use:
360
361              Having  a whole directory tree of photos from my S100, I run the
362              following commands:
363
364              jhead -cmd mogrify -quality 80 &i -model S100 -r *.jpg
365              jhead -cmd jpegtran -progressive &i > &o -r *.jpg
366
367              The first command mogrifies all JPEGs in the tree that  indicate
368              that  they  are  from  a Cannon 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 only  pro‐
374              duces  substantial  savings  on  some cameras, such as the Canon
375              S100.  The newer S110 and S300 cameras  are  smarter  about  how
376              they  compress  JPEG  images, so re-mogrifying them may not give
377              you any savings unless you crank the quality way down.  However,
378              turning  them into progressive JPEG images is a lossless process
379              that typically makes image files 5% smaller.
380
381              Keeping the Exif header information is important  to  me,  as  I
382              like  to check things like the shutter speed for some of my pho‐
383              tos, and my HTML index generating program uses the Exif tags  to
384              display the JPEG images in order of taking.
385
386

SEE ALSO

388       jpegtran(1), mogrify(1), rdjpgcom(1), wrjpgcom(1)
389

AUTHOR

391       Matthias Wandel
392

BUGS

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

COPYING PERMISSIONS

414       Jhead is 'public domain'.  You may freely copy jhead, and reuse part or
415       all of its code in free or proprietary programs.   I do however request
416       that  you  do  not  post my e-mail address in ways that spam robots can
417       harvest it.
418
419
420
421jhead 2.82                        03 Apr 2008                         JHEAD(1)
Impressum