-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathjhead.1
More file actions
363 lines (317 loc) · 12.6 KB
/
Copy pathjhead.1
File metadata and controls
363 lines (317 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
.TH JHEAD 1 "Apil 2026" "jhead 3.3"
.SH NAME
jhead \- Digicam JPEG Exif header manipulation tool
.SH SYNOPSIS
.B jhead
[
.I options
]
[
.I file\.\.\.
]
.LP
.SH DESCRIPTION
.LP
.B jhead
is used to display and manipulate data contained in the Exif header of JPEG images
from digital cameras, as well as Webp and PNG image files.
By default, jhead displays the more useful
camera settings from the file in a user-friendly format.
.PP
.B jhead
can also be used to manipulate some aspects of the Exif header in Jpegs
and also in PNG and Webp files, if present.
this includes changing the internal timestamps, removing the thumbnail.
.PP
Jheaed is designed to be simple and fast. For more sophisticated manipulation
of images, try the much larger exiv2 program, or the large and slow Exiftool
program.
.SH GENERAL METADATA OPTIONS
.TP
.B \-dc
Delete comment field from the JPEG header. Note that this does not manipulate
comments embedded in the Exif header.
.TP
.B \-de
Delete the Exif header entirely. Leaves other metadata sections intact.
.TP
.B \-di
Delete the IPTC section, if present. Leaves other metadata sections intact.
.TP
.B \-dx
Delete the XMP section, if present. Leaves other metadata sections intact.
.TP
.B \-pure \-purejpg
Delete all JPEG sections that aren't necessary for rendering the image.
Strips any metadata that various applications may have left in the
image.
.TP
.B \-mkexif
Creates minimal Exif header. Exif header contains date/time, and empty
thumbnail fields only. Date/time set to file time by default. Use with
\-rgt option if you want the Exif header to contain a thumbnail. Note
that Exif header creation is very limited, no other
fields can be added to the Exif header this way.
.TP
.BI \-\^cl \ string
Replace comment with specified string from command line
.SH DATE / TIME MANIPULATION OPTIONS
.TP
.B \-ft
Sets the file's system time stamp to what is stored in the Exif header.
.TP
.B \-dsft
Sets the Exif timestamp to the file's timestamp. Requires an Exif header to
pre-exist. Use \-mkexif option to create one if needed.
.TP
.BI \-\^n [format_string]
This option causes files to be renamed and/ or moved using the date
information from the Exif header "DateTimeOriginal" field. If the file
is not an Exif file, or the DateTimeOriginal does not contain a valid
value, the file date is used. If the new name contains a '/',
this will be interpreted as a new path, and the file will be moved
accordingly.
If the
.I format_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).
If a
.I format_string
is provided, it will be passed to the strftime function as the format
string. In addition, if the format string contains '%f', this will
substitute the original name of the file (minus extension). '%i' will
substitute a sequence number. Leading zeros can be specified like with
printf - i.e. '%04i' pads the number to 4 digits using leading zeros.
If the name includes '/', this is interpreted as a new path for the file.
If the new path does not exist, the path will be created.
If the target name already exists, the name will be appended with "a",
"b", "c", etc, unless the name ends with a letter, in which case it will
be appended with "0", "1", "2", etc.
This feature is especially useful if more than one digital camera was
used to take pictures of an event. By renaming them to a scheme
according to date, they will automatically appear in order of taking in
most directory listings and image browsers. Alternatively, if your
image browser supports listing by file time, you can use the \-ft option
to set the file time to the time the photo was taken.
Some of the more useful arguments for strftime are:
.BR %H \ Hour\ in\ 24-hour\ format\ (00\ -\ 23)
.br
.BR %j \ Day\ of\ year\ as\ decimal\ number\ (001\ -\ 366)
.br
.BR %m \ Month\ as\ decimal\ number\ (01\ -\ 12)
.br
.BR %M \ Minute\ as\ decimal\ number\ (00\ -\ 59)
.br
.BR %S \ Second\ as\ decimal\ number\ (00\ -\ 59)
.br
.BR %w \ Weekday\ as\ decimal\ number\ (0\ -\ 6;\ Sunday\ is\ 0)
.br
.BR %y \ Year\ without\ century,\ as\ decimal\ number\ (00\ -\ 99)
.br
.BR %Y \ Year\ with\ century,\ as\ decimal\ number
Example:
.I jhead \-n%Y%m%d\-%H%M%S *.jpg
This will rename files matched by *.jpg in the format YYYYMMDD\-HHMMSS
For a full listing of strftime arguments, look up the strftime in the
man pages. Note that some arguments to the strftime function (not
listed here) produce strings with characters such as ':' that may not be
valid as part of a filename on some systems.
.TP
.B \-ta<+|\-><timediff>
Adjust time stored in the Exif header by h:mm or h:mm:ss forwards or backwards.
Useful when having taken pictures with the wrong time set on the camera,
such as after travelling across time zones, or when daylight savings
time has changed.
Examples:
Add 1 hour and 5 minutes to the time
.br
jhead \-ta+1:05
Decrease time by one second:
.br
jhead \-ta-0:0:1
This option changes all Date/time fields in the exif header, including
"DateTimeOriginal" (tag 0x9003) and "DateTimeDigitized" (tag 0x9004).
.TP
.B \-da<newdate>\-<olddate>
Works like \-ta, but for specifying large date offsets, to be used when
fixing dates from cameras where the date was set incorrectly, such as
having date and time reset by battery removal on some cameras
Because different months and years have different numbers of days in
them, a simple offset for months, days, years would lead to unexpected
results at times. The time offset is thus specified as a difference
between two dates, so that jhead can figure out exactly how many days
the timestamp needs to be adjusted by, including leap years and daylight
savings time changes. The dates are specified as yyyy:mm:dd. For
sub-day adjustments, a time of day can also be included, by specifying
yyyy:nn:dd/hh:mm or yyyy:mm:dd/hh:mm:ss
Examples:
Year on camera was set to 2005 instead of 2004 for pictures taken in April
.br
jhead \-da2004:03:01\-2005:03:01
Default camera date is 2002:01:01, and date was reset on 2005:05:29 at 11:21 am
.br
jhead \-da2005:05:29/11:21\-2002:01:01
.TP
.B \-ts
Sets the time stored in the Exif header to what is specified on the
command line.
Time must be specified as:
.I yyyy:mm:dd\-hh:mm:ss
.TP
.B \-ds
Sets the date stored in the Exif header to what is specified on the
command line.
Can be used to set date, just year and month, or just year.
Date is specified as:
.I yyyy:mm:dd, yyyy:mm, or yyyy
.SH THUMBNAIL MANIPULATION OPTIONS
.TP
.B \-dt
Delete thumbnails from the Exif header, but leave the interesting parts
intact. This option truncates the thumbnail from the Exif header,
provided that the thumbnail is the last part of the Exif header (which
so far as I know is always the case). Exif headers have a built-in
thumbnail, which typically occupies around 10k of space. This thumbnail
is used by digital cameras. Windows may also use this thumbnail if
present (but it doesn't need it). The thumbnails are too small to use
even full screen preview on the camera's LCD. I have not encountered any
adverse effects of deleting the thumbnails.
.TP
.BI \-\^st \ file
Save the integral thumbnail to
.I file
The thumbnail lives inside the Exif header, and is a very low-res JPEG
image.
The thumbnail is too low res to really use for very much.
This feature has an interesting 'relative path' option for specifying
the thumbnail name. Whenever the name for
.I file
contains the characters '&i',
.B 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:
.I jhead \-st "thumbnails/&i" *.jpg
would create a thumbnail for each .jpg file in the thumbnails directory
by the same name, (provided that the thumbnails directory exists, of
course). Both Win32 and UNIX shells treat the '&'character in a special
way, so you have to put quotes around that command line option for the '&'
to even be passed to the program.
If a '\-' is specified for the output file, the thumbnail is sent to
stdout. (UNIX build only)
.TP
.B \-rt
Replace thumbnails from the Exif header. This only works if the exif
header already contains a thumbnail, and the thumbnail is at the end of
the header (both always the case if the photo came from a digital
camera)
.TP
.BI \-\^rgt[size]
Regenerate Exif thumbnail. 'size' specifies maximum height or width of
thumbnail. Relies on the ImageMagick 'magick'(on Windows) or
'convert'(on Linux) program to regenerate
the thumbnail. This only works if the image already contains a
thumbnail.
.SH ROTATION OPTIONS
.TP
.B \-autorot
Using the 'Orientation' tag of the Exif header, rotate the image so that
it is upright. The program
.B jpegtran
is used to perform the rotation. This program is present in most Linux
distributions. For Windows, you need to get a copy of it. After
rotation, the orientation tag of the Exif header is set to '1' (normal
orientation). The thumbnail is also rotated. Other fields of the Exif
header, including dimensions are untouched, but the JPEG height/width
are adjusted. This feature is useful as digital cameras will set
the orientation field of the image by which way the camera is held
while taking a photograph. Most, programs will rotate
the image according to the rotation field in the Exif header when
displaying, but Rotating the actual image is a safer way to ensure it
doesn't end up showing sideways in some programs.
.TP
.B \-norot
Clears the rotation field in the Exif header without altering the image.
Useful if the images were previously rotated without clearing the Exif
rotation tag, as some image browsers will auto rotate images when the
rotation tag is set. Sometimes, thumbnails and rotation tags can get
out of sync from manipulation with various tools. To reset it all
use \-norot with \-rgt to clear this out.
.SH OUTPUT VERBOSITY CONTROL
.TP
.B \-h
Displays summary of command line options.
.TP
.B \-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.
.TP
.B \-q
No output on success, more like Unix programs.
.TP
.B \-V
Print version info and compilation date.
.B \-exifmap
Show a map of the bytes in the exif header. Useful when analyzing
strange exif headers, not of much use to non software developers.
Use in combination with -v option for more details.
.TP
.B \-se
Suppress error messages relating to corrupt Exif header structure.
.TP
.B \-c
Concise output. This causes picture info to be summarized on one line
instead of several. Useful output to pipe into grep. or importing
into spreadsheets.
.SH FILE MATCHING OPTIONS
.TP
.B \-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:
.I jhead \-model S100 *.jpg
restrict my JPEG reprocessing to those images that
came from my Canon S100 digicam, (see the \-cmd option).
I use this option mostly if I have a collection of photos from different
cameras and need to adjust the time of just one of these cameras as it
had the clock set wrong.
.TP
.B \-exonly
Skip all files that don't have an Exif header. Photos straight from a
digital camera have an Exif header, whereas some photo manipulation
tools discard the Exif header.
.SH SEE ALSO
.BR jpegtran (1),
.BR exiv2 (1),
.BR ExifTool (1),
.BR ImageMagick (1),
.BR rdjpgcom (1),
.BR wrjpgcom (1)
.SH AUTHOR
Matthias Wandel
.SH BUGS
After jhead runs a program to rotate or resize an image, the image
dimensions and thumbnail in the Exif header are not adjusted.
.PP
Modifying of Exif header data is very limited, as Jhead internally only
has a read only implementation of the file system contained in the Exif
header. Thumbnails can only be replaced if they are at the very
end of the Exif header.
.PP
Some Canon digital SLR cameras fail to adjust the effective sensor
resolution when shooting at less than full resolution, causing jhead to
miscalculate the sensor width and 35mm equivalent focal
length. The same can result from resizing photos with Photoshop, which
will manipulate parts of the exif header. This is often reported as a
bug in Jhead, but Jhead can't do much about incorrect data.
.PP
Send bug reports to matthias at woodgears dot ca
.SH COPYING PERMISSIONS
Jhead is 'public domain'. You may freely copy jhead, and reuse part or
all of its code in free or proprietary programs. I do however request
that you do not post my e-mail address in ways that spam robots can
harvest it.