87
87
my $isWriting; # flag set if we are writing tags
88
88
my $mainTool; # main ExifTool object
89
89
my $multiFile; # non-zero if we are scanning multiple files
90
my $outFormat; # 0=Canon format, 1=same-line, 2=tag names, 3=values only
90
my $outFormat; # -1=Canon format, 0=same-line, 1=tag names, 2=values only
91
91
my $outOpt; # output file or directory name
92
92
my $outputExt; # extension for output file (or undef for no output)
93
93
my $overwriteOrig; # flag to overwrite original file
369
369
/^r$/i and $recurse = 1, next;
370
370
/^s$/ and ++$outFormat, next;
371
371
/^S$/ and $outFormat+=2, next;
372
/^scanforxmp$/i and $mainTool->Options(ScanForXMP => 1), next;
372
373
/^srcfile$/i and $srcFmt = shift || Die("Expecting FMT for -srcfile option\n"), next;
373
374
/^t$/i and $tabFormat = 1, next;
374
375
/^u$/ and $mainTool->Options(Unknown => $mainTool->Options('Unknown')+1), next;
430
431
unless ($helped) {
431
432
# catch warnings if we have problems running perldoc
432
433
local $SIG{'__WARN__'} = sub { $evalWarning = $_[0] };
434
my $dummy = \*SAVEERR; # avoid "used only once" warning
434
435
open SAVEERR, ">&STDERR";
436
436
open STDERR, '>/dev/null';
437
437
if (system('perldoc',$0)) {
438
438
print "Syntax: exiftool [OPTIONS] FILE\n\n";
1007
1011
foreach (@exclude) {
1008
1012
push @setTags, "-$_";
1010
# force ICC_Profile to be set if this is an ICC output file
1011
push @setTags, 'ICC_Profile' if $outType eq 'ICC';
1014
# force some tags to be copied for certain file types
1016
ICC => 'ICC_Profile',
1019
push @setTags, $forceCopy{$outType} if $forceCopy{$outType};
1012
1020
return 0 unless DoSetFromFile($exifTool, $file, \@setTags);
1013
1021
# all done with source file -- create from meta information alone
1595
1605
File Types | Meta Information
1596
1606
--------------------------------------- | --------------------
1597
ACR r M4A r PS r/w | EXIF r/w/c
1598
AI r MEF r PSD r/w | GPS r/w/c
1599
AIFF r MIE r/w/c QTIF r | IPTC r/w/c
1600
APE r MIFF r RA r | XMP r/w/c
1601
ARW r MNG r/w RAF r | MakerNotes r/w/c
1602
ASF r MOS r/w RAM r | Photoshop IRB r/w/c
1603
AVI r MOV r RAW r/w | ICC Profile r/w/c
1604
BMP r MP3 r RIFF r | MIE r/w/c
1605
CR2 r/w MP4 r RM r | JFIF r/w/c
1606
CRW r/w MPC r SR2 r | CIFF r/w
1607
DCM r MPG r SRF r | AFCP r/w
1608
DNG r/w MRW r/w SWF r | DICOM r
1609
DOC r NEF r/w THM r/w | FlashPix r
1610
EPS r/w OGG r TIFF r/w | GeoTIFF r
1611
ERF r/w ORF r/w VRD r/w | PrintIM r
1612
FLAC r PBM r/w WAV r | ID3 r
1613
FPX r PDF r WDP r/w | Kodak Meta r
1614
GIF r/w PEF r/w WMA r | Ricoh RMETA r
1615
HTML r PGM r/w WMV r | Picture Info r
1616
ICC r/w/c PICT r X3F r | Adobe APP14 r
1617
JNG r/w PNG r/w XLS r | APE r
1618
JP2 r PPM r/w XMP r/w/c | Vorbis r
1619
JPEG r/w PPT r | (and more)
1607
ACR r JP2 r/w PPT r | EXIF r/w/c
1608
AI r JPEG r/w PS r/w | GPS r/w/c
1609
AIFF r K25 r PSD r/w | IPTC r/w/c
1610
APE r M4A r QTIF r | XMP r/w/c
1611
ARW r MEF r/w RA r | MakerNotes r/w/c
1612
ASF r MIE r/w/c RAF r | Photoshop IRB r/w/c
1613
AVI r MIFF r RAM r | ICC Profile r/w/c
1614
BMP r MNG r/w RAW r/w | MIE r/w/c
1615
BTF r MOS r/w RIFF r | JFIF r/w/c
1616
CR2 r/w MOV r RM r | Ducky APP12 r/w/c
1617
CRW r/w MP3 r SR2 r | CIFF r/w
1618
CS1 r/w MP4 r SRF r | AFCP r/w
1619
DCM r MPC r SWF r | DICOM r
1620
DCR r MPG r THM r/w | Flash r
1621
DNG r/w MRW r/w TIFF r/w | FlashPix r
1622
DOC r NEF r/w VRD r/w/c | GeoTIFF r
1623
EPS r/w OGG r WAV r | PrintIM r
1624
ERF r/w ORF r/w WDP r/w | ID3 r
1625
FLAC r PBM r/w WMA r | Kodak Meta r
1626
FLV r PDF r WMV r | Ricoh RMETA r
1627
FPX r PEF r/w X3F r | Picture Info r
1628
GIF r/w PGM r/w XLS r | Adobe APP14 r
1629
HTML r PICT r XMP r/w/c | APE r
1630
ICC r/w/c PNG r/w | Vorbis r
1631
JNG r/w PPM r/w | (and more)
1621
1633
Note: If I<FILE> is a directory name, then only file types with recognized
1622
1634
extensions are processed when reading, and only writable types are written.
1665
1678
If a group name is not specified for I<TAG>, then the information is written
1666
1679
to the preferred group, which is the first group in the following list where
1667
I<TAG> is valid: 1) EXIF, 2) GPS, 3) IPTC, 4) XMP, 5) MakerNotes.
1680
I<TAG> is valid: 1) EXIF, 2) IPTC, 3) XMP, 4) MakerNotes.
1669
1682
The special C<All> tag may be used in this syntax only if a I<VALUE> is NOT
1670
1683
given. This causes all meta information to be deleted (or all information
1720
Output requested data in B<b>inary format. Mainly used for extracting
1721
embedded images. Suppresses output of tag names and descriptions.
1733
Output requested data in B<b>inary format without tag names or descriptions.
1734
This option is mainly used for extracting embedded images, but it may also
1735
be useful in separating values of list-type tags since a newline is used
1736
instead of a comma to separate these values in the B<-b> output.
1723
1738
=item B<-c> I<FMT>
1852
1869
Convert 16-bit Unicode characters in output to Windows B<L>atin1 (cp1252)
1853
instead of the default UTF-8.
1870
instead of the default UTF-8. When writing, -L is used to specify that
1871
input text values are Latin1 instead of UTF-8.
1855
1873
=item B<-list>, B<-listw>, B<-listf>, B<-listg>[I<NUM>], B<-listd>
1928
1946
extra step results in slower performance, so the B<-overwrite_original>
1929
1947
option should be used instead unless necessary.
1931
=item B<-p> I<FMTFILE> or I<EXPR>
1949
=item B<-p> I<FMTFILE> or I<STR>
1933
B<P>rint output in the format specified by the given file or expression (and
1934
ignore other format options). Tag names in the format file begin with a
1935
C<$> symbol and may contain an optional group name. Case is not
1951
B<P>rint output in the format specified by the given file or string (and
1952
ignore other format options). Tag names in the format file or string begin
1953
with a C<$> symbol and may contain an optional group name. Case is not
1936
1954
significant. Braces C<{}> may be used around the tag name to separate it
1937
1955
from subsequent text. Use C<$$> to represent a C<$> symbol. In the file,
1938
1956
lines beginning with C<#> are ignored. For example, this format file:
1972
1990
Print tag names instead of descriptions. This is the B<s>hort output
1973
format. Add up to 3 B<-s> options for even shorter formats. Also effective
1974
when combined with B<-t> or B<-h> options.
1991
format. Add up to 3 B<-s> options for even shorter formats:
1993
-s - print tag names instead of descriptions
1994
-s -s - no extra spaces to column-align values
1995
-s -s -s - print values only
1997
Also effective when combined with B<-t> or B<-h> options.
1978
2001
Very B<s>hort format. The same as two B<-s> options. Extra spaces used
1979
2002
to column-align values are not printed.
2004
=item B<-ScanForXMP>
2006
Scan all files (even unrecognized formats) for XMP information unless found
2007
already. When combined with the B<-fast> option, only unrecognized file
2008
types are scanned. Warning: It can be time consuming to scan large files.
1983
2012
Output a B<t>ab-delimited list of description/values (useful for database
2027
2056
E<quot>'-I<SRCTAG>+E<gt>I<DSTTAG>'E<quot> or
2028
2057
E<quot>'-I<SRCTAG>-E<gt>I<DSTTAG>'E<quot>.
2030
An extension of the redirection feature allows expressions involving tag
2031
names to be used on the right hand side of the C<E<lt>> symbol with the
2032
syntax E<quot>'-I<DSTTAG>E<lt>I<EXPR>'E<quot>, where tag names in I<EXPR>
2033
are prefixed with a C<$> symbol. See the B<-p> option for more details
2034
about this syntax. Expressions starting with a C<=> sign must insert a
2035
single space after the C<E<lt>> to avoid confusion with the C<E<lt>=> syntax
2036
which would otherwise attempt to set the tag value from the contents of a
2037
file. A single space at the start of an expression is removed if it exists,
2038
but all other whitespace is preserved.
2059
An extension of the redirection feature allows strings involving tag names
2060
to be used on the right hand side of the C<E<lt>> symbol with the syntax
2061
E<quot>'-I<DSTTAG>E<lt>I<STR>'E<quot>, where tag names in I<STR> are
2062
prefixed with a C<$> symbol. See the B<-p> option for more details about
2063
this syntax. Strings starting with a C<=> sign must insert a single space
2064
after the C<E<lt>> to avoid confusion with the C<E<lt>=> syntax which would
2065
otherwise attempt to set the tag value from the contents of a file. A
2066
single space at the start of the string is removed if it exists, but all
2067
other whitespace is preserved.
2040
2069
See L</COPYING EXAMPLES> for examples using B<-TagsFromFile>.
2138
2167
-w F%+c.txt # F.txt, F_1.txt F_2.txt ...
2139
2168
-w G%-lc.txt # G.txt, G-b.txt, G-c.txt ...
2141
The format codes may also be modified by 'l' or 'u' to specify lower or
2170
All format codes may also be modified by 'l' or 'u' to specify lower or
2142
2171
upper case respectively (ie. "%le" for a lower case file extension). When
2143
2172
used to modify the copy number, the numbers are changed to an alphabetical
2144
2173
base (ie. as with "%lc" in the last example above).
2248
2277
Extract image resolution from EXIF IFD1 information (thumbnail image IFD).
2250
=item exiftool -xmp -b a.jpg > xmp.out
2279
=item exiftool -xmp -b a.jpg > out.xmp
2252
2281
Extract complete XMP data record intact from C<a.jpg> and write it to
2253
C<xmp.out> using the special C<XMP> tag (see the Extra tags in
2282
C<out.xmp> using the special C<XMP> tag (see the Extra tags in
2254
2283
L<Image::ExifTool::TagNames|Image::ExifTool::TagNames>).
2285
=item exiftool -icc_profile -b -w icc image.jpg
2287
Save complete ICC_Profile from an image to an output file with the same name
2288
and an extension of C<.icc>.
2256
2290
=item exiftool -htmldump -w tmp/%f_%e.html t/images
2258
2292
Generate HTML pages from a hex dump of EXIF information in all images from
2343
2377
is provided as a shortcut for these three tags, allowing them to be accessed
2344
2378
via a single tag.)
2346
=item exiftool -xmp:city=Kingston dst.jpg
2380
=item exiftool -xmp:city=Kingston image1.jpg image2.nef
2348
Write a tag to the XMP group (otherwise in this case the tag would get
2349
written to the IPTC group since C<City> exists in both, and IPTC has
2382
Write a tag to the XMP group of two images. (Without the C<xmp:> this tag
2383
would get written to the IPTC group since C<City> exists in both, and IPTC
2384
is preferred by default.)
2352
2386
=item exiftool -LightSource-='Unknown (0)' dst.tiff