~ubuntu-branches/ubuntu/karmic/libimage-exiftool-perl/karmic

« back to all changes in this revision

Viewing changes to exiftool

  • Committer: Bazaar Package Importer
  • Author(s): Mari Wang
  • Date: 2008-02-04 20:32:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080204203253-mpbal8trlfe1fz5d
Tags: 7.00-1
* Upload of new production release (Closes: #456430)
* Added Recommends: libcompress-zlib-perl (Closes: #435589)
* Package now includes iptc2xmp.args and xmp2iptc.args, they are put
  into /usr/share/libimage-exiftool/ (Closes: #436100)
* Updated standards-version (3.7.2 -> 3.7.3). No changes needed.
* Lots of updates and bugfixes compared to last debian version
  (6.90).  See the Changes file for details
* Upload sponsored by Petter Reinholdtsen

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
229
229
}
230
230
 
231
231
$mainTool = new Image::ExifTool;        # create ExifTool object
232
 
$mainTool->Options(Duplicates => 0);    # don't save duplicates by default
 
232
$mainTool->Options(Duplicates => 0);    # don't extract duplicates by default
233
233
 
234
234
# parse command-line options
235
235
while ($_ = shift) {
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] };
433
 
        no warnings;
 
434
        my $dummy = \*SAVEERR;  # avoid "used only once" warning
434
435
        open SAVEERR, ">&STDERR";
435
 
        use warnings;
436
436
        open STDERR, '>/dev/null';
437
437
        if (system('perldoc',$0)) {
438
438
            print "Syntax:  exiftool [OPTIONS] FILE\n\n";
855
855
            my $id;
856
856
            if ($binaryOutput) {
857
857
                # translate scalar reference to actual binary data
858
 
                $val = $$val if ref $val eq 'SCALAR';
 
858
                if (ref $val eq 'SCALAR') {
 
859
                    $val = $$val;
 
860
                } elsif (ref $val eq 'ARRAY') {
 
861
                    $val = join "\n", @$val;
 
862
                }
859
863
                print $fp $val;
860
864
                next;
861
865
            }
1007
1011
                            foreach (@exclude) {
1008
1012
                                push @setTags, "-$_";
1009
1013
                            }
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
 
1015
                            my %forceCopy = (
 
1016
                                ICC => 'ICC_Profile',
 
1017
                                VRD => 'CanonVRD',
 
1018
                            );
 
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
1014
1022
                            $file = '';
1219
1227
                    # erase original file
1220
1228
                    unlink $file or Warn "Error erasing original $file\n";
1221
1229
                    ++$countGoodWr;
 
1230
                } else {
 
1231
                    ++$countGoodCr;
1222
1232
                }
1223
1233
            } else {
1224
1234
                # this file was created from scratch, not edited
1594
1604
 
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)
1620
1632
 
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.
1653
1665
 
1654
1666
Exclude specified tag from extracted information.  Same as the B<-x> option.
1655
1667
May also be used following a B<-TagsFromFile> option to exclude tags from
1656
 
being copied.
 
1668
being copied, or to exclude groups from being deleted when deleting all
 
1669
information (ie. C<-all= --exif:all> deletes all but EXIF information).
1657
1670
 
1658
1671
=item B<->I<TAG>[+-]B<=>[I<VALUE>]
1659
1672
 
1664
1677
 
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.
1668
1681
 
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
1717
1730
 
1718
1731
=item B<-b>
1719
1732
 
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.
1722
1737
 
1723
1738
=item B<-c> I<FMT>
1724
1739
 
1738
1753
 
1739
1754
Set the format for B<d>ate/time tag values.  Consult C<strftime> man page
1740
1755
for I<FMT> syntax. The default format is equivalent to "%Y:%m:%d %H:%M:%S".
1741
 
This option has no effect on date-only or time-only tags.
 
1756
This option has no effect on date-only or time-only tags, and ignores
 
1757
timezone information if present.
1742
1758
 
1743
1759
=item B<-D>
1744
1760
 
1812
1828
dumped.  An I<OFFSET> may be given to specify the base for displayed
1813
1829
offsets.  If not provided, the EXIF/TIFF base offset is used.  Use
1814
1830
B<-htmlDump0> for absolute offsets.  Currently only EXIF and TIFF
1815
 
information is dumped.
 
1831
information is dumped, but the -u option can be used to give a raw hex dump
 
1832
of other file formats.
1816
1833
 
1817
1834
=item B<-i> I<DIR>
1818
1835
 
1850
1867
=item B<-L>
1851
1868
 
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.
1854
1872
 
1855
1873
=item B<-list>, B<-listw>, B<-listf>, B<-listg>[I<NUM>], B<-listd>
1856
1874
 
1928
1946
extra step results in slower performance, so the B<-overwrite_original>
1929
1947
option should be used instead unless necessary.
1930
1948
 
1931
 
=item B<-p> I<FMTFILE> or I<EXPR>
 
1949
=item B<-p> I<FMTFILE> or I<STR>
1932
1950
 
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:
1970
1988
=item B<-s>
1971
1989
 
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:
 
1992
 
 
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
 
1996
 
 
1997
Also effective when combined with B<-t> or B<-h> options.
1975
1998
 
1976
1999
=item B<-S>
1977
2000
 
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.
1980
2003
 
 
2004
=item B<-ScanForXMP>
 
2005
 
 
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.
 
2009
 
1981
2010
=item B<-t>
1982
2011
 
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>.
2029
2058
 
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.
2039
2068
 
2040
2069
See L</COPYING EXAMPLES> for examples using B<-TagsFromFile>.
2041
2070
 
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 ...
2140
2169
 
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).
2247
2276
 
2248
2277
Extract image resolution from EXIF IFD1 information (thumbnail image IFD).
2249
2278
 
2250
 
=item exiftool -xmp -b a.jpg > xmp.out
 
2279
=item exiftool -xmp -b a.jpg > out.xmp
2251
2280
 
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>).
2255
2284
 
 
2285
=item exiftool -icc_profile -b -w icc image.jpg
 
2286
 
 
2287
Save complete ICC_Profile from an image to an output file with the same name
 
2288
and an extension of C<.icc>.
 
2289
 
2256
2290
=item exiftool -htmldump -w tmp/%f_%e.html t/images
2257
2291
 
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.)
2345
2379
 
2346
 
=item exiftool -xmp:city=Kingston dst.jpg
 
2380
=item exiftool -xmp:city=Kingston image1.jpg image2.nef
2347
2381
 
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
2350
 
priority).
 
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.)
2351
2385
 
2352
2386
=item exiftool -LightSource-='Unknown (0)' dst.tiff
2353
2387
 
2365
2399
 
2366
2400
Create an XMP data file only from tags defined on the command line.
2367
2401
 
 
2402
=item exiftool '-ICC_Profile<=%d%f.icc' image.jpg
 
2403
 
 
2404
Write ICC_Profile to an image from a C<.icc> file of the same name.
 
2405
 
2368
2406
=back
2369
2407
 
2370
2408
=head1 COPYING EXAMPLES
2452
2490
and ShutterSpeed tags.  The resulting comment will be in the form "ISO=100
2453
2491
Exposure=1/60".
2454
2492
 
 
2493
=item exiftool -TagsFromFile src.jpg -icc_profile dst.jpg
 
2494
 
 
2495
Copy ICC_Profile from one image to another.
 
2496
 
2455
2497
=item exiftool -if '$jpgfromraw' -b -jpgfromraw -w %d%f_%ue.jpg -execute
2456
2498
-if '$previewimage' -b -previewimage -w %d%f_%ue.jpg -execute
2457
2499
-tagsfromfile @ -srcfile %d%f_%ue.jpg -overwrite_original