Image-ExifTool

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


Feb. 9, 2022 - Version 12.40

  - Added PageCount tag to return the number of pages in a multi-page TIFF
  - Added a new Nikon LensID (thanks Wolfgang Exler)
  - Added a few more Sony LensTypes (thanks Jos Roost)
  - Decode some new Canon tags (thanks Mark Reid)
  - Decode another Nikon Z9 tag (thanks Warren Hatch)
  - Decode Nikon NKSC GPSImgDirection (thanks Olaf)
  - Improved handling of empty XMP structures in lists
  - Tolerate leading UTF-8 BOM in -geotag log files
  - Updated photoshop_paths.config to include WorkingPath
  - Patched to allow writing of MP4 videos which have url tracks with a missing
    sample description entry
  - Fixed deep recursion error when reading multi-page TIFF images with more
    than 100 pages
  - Fixed potential deep recursion runtime error when writing nested XMP
    structures
  - Fixed warning which could be generated when writing new
    Composite:GPSCoordinates tag
  - Fixed description of GPR (General Purpose RAW) file type

Changes  view on Meta::CPAN

  - Fixed decoding of PictureControl tags for Nikon Z-7
  - Fixed problem writing date/time values with " DST" designator at end of
    date/time string
  - Fixed problem in Windows which could cause ExifTool to abort due to a
    Win32::FindFile error if a file name contained surrogate Unicode characters

Dec. 21, 2018 - Version 11.23

  - Recognize DWG and DWF files
  - Minor improvement to some -validate warnings
  - Tolerate leading UTF-8 byte order mark (BOM) at start of JSON files
  - Fixed problem recognizing some streaming camm metadata in QuickTime videos

Dec. 13, 2018 - Version 11.22

  - Added read support for PC Paintbrush (PCX) files
  - Added two new Sony/Minolta LensTypes (thanks Jos Roost and LibRaw)
  - Decode LensData tags for some newer Nikon models
  - Decode ColorData for the Canon EOS R (thanks LibRaw)
  - Recognize DCX files

Changes  view on Meta::CPAN

  - Decode a few more FLIR tags
  - Generate missing default language tags for alternate-language QuickTime tags
    without them
  - Improved identification of some file sub-types based on filename extension
  - Fixed bug extracting alternate-language QuickTime tags with numerical ID's
    when processing multiple files in a single command
  - Fixed potential problem when using some of the recently added options with
    the -stay_open feature
  - Fixed problem loading a config file with a single quote in the file name
  - Fixed problem writing a shortcut tag when the target tag has a group name
  - Fixed problem recognizing HTML files with a leading UTF-8 BOM

Feb. 22, 2014 - Version 9.53 (production release)

  - Added user-defined file types feature
  - Added support for a few more XMP-expressionmedia tags
  - Decode CameraTemperature from a few new Canon models
  - Decode another Sony tag (thanks Jos Roost)
  - Recognize the JXR extension
  - Changed wording of IPTC "Unrecognized data" warning
  - Patched round-off error problem in seconds of some date/time values

Changes  view on Meta::CPAN

  - Added ability to read/write ICC_Profile in GIF images
  - Added ability to specify internal encoding of EXIF "ASCII" strings and
    QuickTime strings
  - Added a new DigiKam XMP tag
  - Documented -echo option (has been an undocumented feature since 6.86)
  - Decode a number of new Sony tags
  - Decode a few new Pentax tags and added a few new values
  - Decode a few new QuickTime and ID3 tags
  - Decode Casio BestShotMode for a number of models
  - Improved validity checking of ICC_Profile segments in JPEG image
  - Tolerate UTF-8 byte order mark (BOM) in input CSV and JSON files
  - No longer trim trailing spaces from arguments in -@ argfiles
  - Upgraded Windows executable version to use PAR 1.002
  - Changed priority of the Sony DynamicRangeOptimizer tags
  - Changed MWG feature to use UTF8 encoding for EXIF strings by default
  - Changed the -b option to avoid loading large binary values for tags that
    have been excluded with the -x option or --TAG
  - Changed Canon AFMicroAdjActive to AFMicroAdjMode and improved decoding
  - Fixed problem where the PreviewImage could be lost when writing to images
    from some newer Sony cameras
  - Fixed problem reporting duplicate information when -if used with -TAG#

Changes  view on Meta::CPAN

    caused by bugs in Picasa and ACDSee
  - API Changes:
      - Enhanced GetTagID() to also return language code in list context

Feb. 17, 2009 - Version 7.69

  - Added a new Nikon LensID (thanks Jens Kriese)
  - Added a new Pentax LensType (thanks Jens Duttke)
  - Added Extra JPEGDigest tag
  - Recognize new Panasonic APP2 MPF information written by FX40
  - Improved -@ option to allow a UTF-8 BOM at the start of the input file
  - Augmented -listx output to include indexed value conversions
  - Changed Japanese and Chinese language codes to 'ja' and 'zh' (ISO 639-1)
  - Fixed a few problems with some CanonCustom tags

Feb. 13, 2009 - Version 7.68

  - Added French translations for XMP and Composite tags (thanks Jean Piquemal)
  - Decode Panasonic AdvancedSceneMode, added a few more SceneMode values, and
    fixed incorrect format for TextStamp
  - Decode a missing Canon 1DmkII custom function

Changes  view on Meta::CPAN

Jan. 31, 2007 - Version 6.73

  - Added read support for meta information in HTML and XHTML documents
  - Added ability to write certain EXIF tags (eg. UserComment) as Unicode
  - Added character set translation for XMP information; the -L option now works
    for all common meta information formats! (see updated FAQ #10 for details)
  - Added a few more XMP-microsoft tags (thanks Kees Moerman)
  - Decode FirmwareRevision found in some Canon PowerShot models
  - Preserve date/time tags that exist in the wrong EXIF IFD when shifting times
  - Fixed bug which could result in an incorrect value for the Directory tag
  - Fixed problem parsing XMP with BOM introduced in 6.71

Jan. 25, 2007 - Version 6.72

  - Added XMP-microsoft:LastKeywordIPTC tag
  - Renamed new MicrosoftPhoto Rating2 tag to RatingPercent
  - Fixed problem where rdf:about attribute could be lost when writing XMP

Jan. 24, 2007 - Version 6.71

  - Decode a lot of new Pentax DSLR information (thanks Cvetan Ivanov)

Changes  view on Meta::CPAN

  - Enhanced -p option to allow expressions to be used
  - The -p option no longer suppresses error and warning messages
  - Made ImageSourceData writable
  - Reduced font size of htmldump output
  - Fixed "Argument isn't numeric" error when reading an image with a missing
    IFD offset

Jan. 3, 2007 - Version 6.68

  - Added mechanism to allow Composite tags to be writable
  - Recognize XMP sidecar files that begin with a UTF BOM (byte order mark)
  - Changed TIFF ImageSourceData tag to a Binary data type
  - Fixed problem which could cause warning when writing XMP in PNG images
  - Fixed bug when shifting times in an XMP sidecar file that caused an invalid
    date/time to be written if the tag didn't previously exist
  - Fixed problem where writing to a JPEG image containing a PreviewImage could
    report that the file was updated even if nothing was changed

Dec. 30, 2006 - Version 6.67 - "Adobe DNGPrivateData"

  - Added ability to write MakerNote information written by Adobe DNG Converter

exiftool  view on Meta::CPAN

            }
        }
        if ($stayOpen == 1) {
            $stayOpenFile = $argFile;   # remember the name of the file we have open
            $stayOpenBuff = '';         # initialize buffer for reading this file
            $stayOpen = 2;
            $helped = 1;
            ReadStayOpen(\@ARGV);
            next;
        }
        my (@newArgs, $didBOM);
        foreach (<ARGFILE>) {
            # filter Byte Order Mark if it exists from start of UTF-8 text file
            unless ($didBOM) {
                s/^\xef\xbb\xbf//;
                $didBOM = 1;
            }
            $_ = FilterArgfileLine($_);
            push @newArgs, $_ if defined $_;
        }
        close ARGFILE;
        unshift @ARGV, @newArgs;
        next;
    }
    /^(-?)(a|duplicates)$/i and $mt->Options(Duplicates => ($1 ? 0 : 1)), next;
    if ($a eq 'api') {

html/ancient_history.html  view on Meta::CPAN


<a name='v12.40'><b>Feb. 9, 2022 - Version 12.40</b></a>
<ul>
<li>Added PageCount tag to return the number of pages in a multi-page TIFF
<li>Added a new Nikon LensID (thanks Wolfgang Exler)
<li>Added a few more Sony LensTypes (thanks Jos Roost)
<li>Decode some new Canon tags (thanks Mark Reid)
<li>Decode another Nikon Z9 tag (thanks Warren Hatch)
<li>Decode Nikon NKSC GPSImgDirection (thanks Olaf)
<li>Improved handling of empty XMP structures in lists
<li>Tolerate leading UTF-8 BOM in -geotag log files
<li>Updated photoshop_paths.config to include WorkingPath
<li>Patched to allow writing of MP4 videos which have url tracks with a missing
    sample description entry
<li>Fixed deep recursion error when reading multi-page TIFF images with more
    than 100 pages
<li>Fixed potential deep recursion runtime error when writing nested XMP
    structures
<li>Fixed warning which could be generated when writing new
    Composite:GPSCoordinates tag
<li>Fixed description of GPR (General Purpose RAW) file type

html/ancient_history.html  view on Meta::CPAN

<li>Fixed problem writing date/time values with " DST" designator at end of
    date/time string
<li>Fixed problem in Windows which could cause ExifTool to abort due to a
    Win32::FindFile error if a file name contained surrogate Unicode characters
</ul>

<a name='v11.23'><b>Dec. 21, 2018 - Version 11.23</b></a>
<ul>
<li>Recognize DWG and DWF files
<li>Minor improvement to some -validate warnings
<li>Tolerate leading UTF-8 byte order mark (BOM) at start of JSON files
<li>Fixed problem recognizing some streaming camm metadata in QuickTime videos
</ul>

<a name='v11.22'><b>Dec. 13, 2018 - Version 11.22</b></a>
<ul>
<li>Added read support for PC Paintbrush (PCX) files
<li>Added two new Sony/Minolta LensTypes (thanks Jos Roost and LibRaw)
<li>Decode LensData tags for some newer Nikon models
<li>Decode ColorData for the Canon EOS R (thanks LibRaw)
<li>Recognize DCX files

html/ancient_history.html  view on Meta::CPAN

<li>Decode a few more FLIR tags
<li>Generate missing default language tags for alternate-language QuickTime tags
    without them
<li>Improved identification of some file sub-types based on filename extension
<li>Fixed bug extracting alternate-language QuickTime tags with numerical ID's
    when processing multiple files in a single command
<li>Fixed potential problem when using some of the recently added options with
    the -stay_open feature
<li>Fixed problem loading a config file with a single quote in the file name
<li>Fixed problem writing a shortcut tag when the target tag has a group name
<li>Fixed problem recognizing HTML files with a leading UTF-8 BOM
</ul>

<a name='v9.53'><b>Feb. 22, 2014 - Version 9.53</b></a> <span class=grn>(production release)</span>
<ul>
<li>Added user-defined file types feature
<li>Added support for a few more XMP-expressionmedia tags
<li>Decode CameraTemperature from a few new Canon models
<li>Decode another Sony tag (thanks Jos Roost)
<li>Recognize the JXR extension
<li>Changed wording of IPTC "Unrecognized data" warning

html/ancient_history.html  view on Meta::CPAN

<li>Added ability to read/write ICC_Profile in GIF images
<li>Added ability to specify internal encoding of EXIF "ASCII" strings and
    QuickTime strings
<li>Added a new DigiKam XMP tag
<li>Documented -echo option (has been an undocumented feature since 6.86)
<li>Decode a number of new Sony tags
<li>Decode a few new Pentax tags and added a few new values
<li>Decode a few new QuickTime and ID3 tags
<li>Decode Casio BestShotMode for a number of models
<li>Improved validity checking of ICC_Profile segments in JPEG image
<li>Tolerate UTF-8 byte order mark (BOM) in input CSV and JSON files
<li>No longer trim trailing spaces from arguments in -@ argfiles
<li>Upgraded Windows executable version to use PAR 1.002
<li>Changed priority of the Sony DynamicRangeOptimizer tags
<li>Changed MWG feature to use UTF8 encoding for EXIF strings by default
<li>Changed the -b option to avoid loading large binary values for tags that
    have been excluded with the -x option or --TAG
<li>Changed Canon AFMicroAdjActive to AFMicroAdjMode and improved decoding
<li>Fixed problem where the PreviewImage could be lost when writing to images
    from some newer Sony cameras
<li>Fixed problem reporting duplicate information when -if used with -TAG#

html/ancient_history.html  view on Meta::CPAN

    <li>Enhanced GetTagID() to also return language code in list context
    </ul>
</ul>

<a name='v7.69'><b>Feb. 17, 2009 - Version 7.69</b></a>
<ul>
<li>Added a new Nikon LensID (thanks Jens Kriese)
<li>Added a new Pentax LensType (thanks Jens Duttke)
<li>Added Extra JPEGDigest tag
<li>Recognize new Panasonic APP2 MPF information written by FX40
<li>Improved -@ option to allow a UTF-8 BOM at the start of the input file
<li>Augmented -listx output to include indexed value conversions
<li>Changed Japanese and Chinese language codes to 'ja' and 'zh' (ISO 639-1)
<li>Fixed a few problems with some CanonCustom tags
</ul>

<a name='v7.68'><b>Feb. 13, 2009 - Version 7.68</b></a>
<ul>
<li>Added French translations for XMP and Composite tags (thanks Jean Piquemal)
<li>Decode Panasonic AdvancedSceneMode, added a few more SceneMode values, and
    fixed incorrect format for TextStamp

html/ancient_history.html  view on Meta::CPAN

<a name='v6.73'><b>Jan. 31, 2007 - Version 6.73</b></a>
<ul>
<li>Added read support for meta information in HTML and XHTML documents
<li>Added ability to write certain EXIF tags (eg. UserComment) as Unicode
<li>Added character set translation for XMP information; the -L option now works
    for all common meta information formats! (see updated <a href="faq.html#Q10">FAQ #10</a> for details)
<li>Added a few more XMP-microsoft tags (thanks Kees Moerman)
<li>Decode FirmwareRevision found in some Canon PowerShot models
<li>Preserve date/time tags that exist in the wrong EXIF IFD when shifting times
<li>Fixed bug which could result in an incorrect value for the Directory tag
<li>Fixed problem parsing XMP with BOM introduced in 6.71
</ul>

<a name='v6.72'><b>Jan. 25, 2007 - Version 6.72</b></a>
<ul>
<li>Added XMP-microsoft:LastKeywordIPTC tag
<li>Renamed new MicrosoftPhoto Rating2 tag to RatingPercent
<li>Fixed problem where rdf:about attribute could be lost when writing XMP
</ul>

<a name='v6.71'><b>Jan. 24, 2007 - Version 6.71</b></a>

html/ancient_history.html  view on Meta::CPAN

<li>The -p option no longer suppresses error and warning messages
<li>Made ImageSourceData writable
<li>Reduced font size of htmldump output
<li>Fixed "Argument isn't numeric" error when reading an image with a missing
    IFD offset
</ul>

<a name='v6.68'><b>Jan. 3, 2007 - Version 6.68</b></a>
<ul>
<li>Added mechanism to allow Composite tags to be writable
<li>Recognize XMP sidecar files that begin with a UTF BOM (byte order mark)
<li>Changed TIFF ImageSourceData tag to a Binary data type
<li>Fixed problem which could cause warning when writing XMP in PNG images
<li>Fixed bug when shifting times in an XMP sidecar file that caused an invalid
    date/time to be written if the tag didn't previously exist
<li>Fixed problem where writing to a JPEG image containing a PreviewImage could
    report that the file was updated even if nothing was changed
</ul>

<a name='v6.67'><b>Dec. 30, 2006 - Version 6.67</b> - "Adobe DNGPrivateData"</a>
<ul>

lib/Image/ExifTool/Charset.pm  view on Meta::CPAN

        my $byteOrder = $_[3];
        if (not $byteOrder) {
            $byteOrder = GetByteOrder();
        } elsif ($byteOrder eq 'Unknown') {
            $byteOrder = GetByteOrder();
            $unknown = 1;
        }
        my $fmt = $byteOrder eq 'MM' ? 'n*' : 'v*';
        if ($type & 0x400) {    # 4-byte
            $fmt = uc $fmt; # unpack as 'N*' or 'V*'
            # honour BOM if it exists
            $val =~ s/^(\0\0\xfe\xff|\xff\xfe\0\0)// and $fmt = $1 eq "\0\0\xfe\xff" ? 'N*' : 'V*';
            undef $unknown; # (byte order logic applies to 2-byte only)
        } elsif ($val =~ s/^(\xfe\xff|\xff\xfe)//) {
            $fmt = $1 eq "\xfe\xff" ? 'n*' : 'v*';
            undef $unknown;
        }
        # convert from UCS2 or UCS4
        @uni = unpack($fmt, $val);

        if (not $conv) {

lib/Image/ExifTool/FlashPix.pm  view on Meta::CPAN

        last if $pos + $len * 2 > $end;
        my $path = $et->Decode(substr($$dataPt, $pos, $len*2), 'UCS2');
        $pos += $len * 2;
        $et->HandleTag($tagTablePtr, LastSavedBy => "$author ($path)");
        $num -= 2;
    }
    return 1;
}

#------------------------------------------------------------------------------
# Check FPX byte order mark (BOM) and set byte order appropriately
# Inputs: 0) data ref, 1) offset to BOM
# Returns: true on success
sub CheckBOM($$)
{
    my ($dataPt, $pos) = @_;
    my $bom = Get16u($dataPt, $pos);
    return 1 if $bom == 0xfffe;
    return 0 unless $bom == 0xfeff;
    ToggleByteOrder();
    return 1;
}

#------------------------------------------------------------------------------

lib/Image/ExifTool/FlashPix.pm  view on Meta::CPAN

    my $dirLen = $$dirInfo{DirLen} || length($$dataPt) - $pos;
    my $dirEnd = $pos + $dirLen;
    my $verbose = $et->Options('Verbose');
    my $n;

    if ($dirLen < 48) {
        $et->Warn('Truncated FPX properties');
        return 0;
    }
    # check and set our byte order if necessary
    unless (CheckBOM($dataPt, $pos)) {
        $et->Warn('Bad FPX property byte order mark');
        return 0;
    }
    # get position of start of section
    $pos = Get32u($dataPt, $pos + 44);
    if ($pos < 48) {
        $et->Warn('Bad FPX property section offset');
        return 0;
    }
    for ($n=0; $n<2; ++$n) {

lib/Image/ExifTool/Geotag.pm  view on Meta::CPAN

        $/ = $1;
    } else {
        # $val is track file name
        if ($et->Open(\*EXIFTOOL_TRKFILE, $val)) {
            $trackFile = $val;
            $raf = File::RandomAccess->new(\*EXIFTOOL_TRKFILE);
            unless ($raf->Read($_, 256)) {
                close EXIFTOOL_TRKFILE;
                return "Empty track file '${val}'";
            }
            # look for XML or GPX header (might as well allow UTF-8 BOM)
            if (/^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) {
                $format = 'XML';
                $/ = '>';   # set input record separator to '>' for XML/GPX data
            } elsif (/(\x0d\x0a|\x0d|\x0a)/) {
                $/ = $1;
            } else {
                close EXIFTOOL_TRKFILE;
                return "Invalid track file '${val}'";
            }
            $raf->Seek(0,0);

lib/Image/ExifTool/Geotag.pm  view on Meta::CPAN

    my $skipped = 0;
    my $lastSecs = 0;
    my $fix = { };
    my $csvDelim = $et->Options('CSVDelim');
    $csvDelim = ',' unless defined $csvDelim;
    my (@saveFix, @saveTime, $timeSpan);
    for (;;) {
        $raf->ReadLine($_) or last;
        # determine file format
        if (not $format) {
            s/^\xef\xbb\xbf//;          # remove leading BOM if it exists
            if (/^\xff\xfe|\xfe\xff/) {
                return "ExifTool doesn't yet read UTF16-format track logs";
            }
            if (/^<(\?xml|gpx)[\s>]/) { # look for XML or GPX header
                $format = 'XML';
            # check for NMEA sentence
            # (must ONLY start with ones that have timestamps! eg. not GSA or PTNTHPR!)
            } elsif (/^.*\$([A-Z]{2}(RMC|GGA|GLL|ZDA)|PMGNTRK),/) {
                $format = 'NMEA';
                $nmeaStart = $2 || $1;  # save type of first sentence

lib/Image/ExifTool/ID3.pm  view on Meta::CPAN

# Returns: genre ID number, or undef
sub GetGenreID($)
{
    return Image::ExifTool::ReverseLookup(shift, \%genre);
}

#------------------------------------------------------------------------------
# Decode ID3 string
# Inputs: 0) ExifTool object reference
#         1) string beginning with encoding byte unless specified as argument
#         2) optional encoding (0=ISO-8859-1, 1=UTF-16 BOM, 2=UTF-16BE, 3=UTF-8)
# Returns: Decoded string in scalar context, or list of strings in list context
sub DecodeString($$;$)
{
    my ($et, $val, $enc) = @_;
    return '' unless length $val;
    unless (defined $enc) {
        $enc = unpack('C', $val);
        $val = substr($val, 1); # remove encoding byte
    }
    my @vals;
    if ($enc == 0 or $enc == 3) { # ISO 8859-1 or UTF-8
        $val =~ s/\0+$//;   # remove any null padding
        # (must split before converting because conversion routines truncate at null)
        @vals = split "\0", $val;
        foreach $val (@vals) {
            $val = $et->Decode($val, $enc ? 'UTF8' : 'Latin');
        }
    } elsif ($enc == 1 or $enc == 2) {  # UTF-16 with BOM, or UTF-16BE
        my $bom = "\xfe\xff";
        my %order = ( "\xfe\xff" => 'MM', "\xff\xfe", => 'II' );
        for (;;) {
            my $v;
            # split string at null terminators on word boundaries
            if ($val =~ s/((..)*?)\0\0//s) {
                $v = $1;
            } else {
                last unless length $val > 1;
                $v = $val;

lib/Image/ExifTool/Import.pm  view on Meta::CPAN

            # figure out the file name to use
            if ($fileInfo{SourceFile}) {
                $$database{$fileInfo{SourceFile}} = \%fileInfo;
                $found = 1;
            }
        } else {
            # the first row should be the tag names
            foreach (@vals) {
                # terminate at first blank tag name (eg. extra comma at end of line)
                last unless length $_;
                @tags or s/^\xef\xbb\xbf//; # remove UTF-8 BOM if it exists
                /^([-_0-9A-Z]+:)*[-_0-9A-Z]+#?$/i or $err = "Invalid tag name '${_}'", last;
                push(@tags, $_);
            }
            last if $err;
            @tags or $err = 'No tags found', last;
            # fix "SourceFile" case if necessary
            $tags[0] = 'SourceFile' if lc $tags[0] eq 'sourcefile';
        }
    }
    close CSVFILE if $openedFile;

lib/Image/ExifTool/Import.pm  view on Meta::CPAN

# Read JSON object from file
# Inputs: 0) RAF reference or undef, 1) optional scalar reference for data
#            to read before reading from file (ie. the file read buffer)
# Returns: JSON object (scalar, hash ref, or array ref), or undef on EOF or
#          empty object or array (and sets $$buffPt to empty string on EOF)
# Notes: position in buffer is significant
sub ReadJSONObject($;$)
{
    my ($raf, $buffPt) = @_;
    # initialize buffer if necessary
    my ($pos, $readMore, $rtnVal, $tok, $key, $didBOM);
    if ($buffPt) {
        $pos = pos $$buffPt;
        $pos = pos($$buffPt) = 0 unless defined $pos;
    } else {
        my $buff = '';
        $buffPt = \$buff;
        $pos = 0;
    }
Tok: for (;;) {
        # (didn't spend the time to understand how $pos could be undef, but

lib/Image/ExifTool/Import.pm  view on Meta::CPAN

            last unless defined $raf;
            # read another 64kB and add to unparsed data
            my $offset = length($$buffPt) - $pos;
            if ($offset) {
                my $buff;
                $raf->Read($buff, 65536) or $$buffPt = '', last;
                $$buffPt = substr($$buffPt, $pos) . $buff;
            } else {
                $raf->Read($$buffPt, 65536) or $$buffPt = '', last;
            }
            unless ($didBOM) {
                $$buffPt =~ s/^\xef\xbb\xbf//;  # remove UTF-8 BOM if it exists
                $didBOM = 1;
            }
            $pos = pos($$buffPt) = 0;
            $readMore = 0;
        }
        unless ($tok) {
            # skip white space and find next character
            $$buffPt =~ /(\S)/g or $pos = length($$buffPt), next;
            $tok = $1;
            $pos = pos $$buffPt;
        }

lib/Image/ExifTool/MIE.pm  view on Meta::CPAN


=item 3.

Text strings are not normally null terminated, however they may be padded
with one or more null characters to the end of the data block to allow
strings to be edited within fixed-length data blocks.  Newlines in the text
are indicated by a single LF (0x0a) character.

=item 4.

UTF strings must not begin with a byte order mark (BOM) since the byte order
and byte size are specified by the MIE format.  If a BOM is found, it should
be treated as a zero-width non-breaking space.

=item 5.

A list of text strings separated by null characters.  These lists must not
be null padded or null terminated, since this would be interpreted as
additional zero-length strings.  For ASCII and UTF-8 strings, the null
character is a single zero (0x00) byte.  For UTF-16 or UTF-32 strings, the
null character is 2 or 4 zero bytes respectively.

lib/Image/ExifTool/MIE.pm  view on Meta::CPAN


    exiftool -comment-en_us='this is a comment' test.mie

=head1 REVISIONS

  2010-04-05 - Fixed "Format Size" Note 7 to give the correct number of bits
               in the example rational value
  2007-01-21 - Specified LF character (0x0a) for text newline sequence
  2007-01-19 - Specified ISO 8859-1 character set for extended ASCII codes
  2007-01-01 - Improved wording of Step 5 for scanning backwards in MIE file
  2006-12-30 - Added EXAMPLES section and note about UTF BOM
  2006-12-20 - MIE 1.1:  Changed meaning of TypeModifier bit (0x08) for
               unknown data (FormatType 0x00), and documented byte swapping
  2006-12-14 - MIE 1.0:  Added Data Values and Numerical Representations
               sections, and added ability to specify units in tag names
  2006-11-09 - Added Levels of Support section
  2006-11-03 - Added Trailer Signature
  2005-11-18 - Original specification created

=head1 AUTHOR

lib/Image/ExifTool/PLIST.pm  view on Meta::CPAN

        }
        delete $$et{SET_GROUP1};
        $result = 1;
    } elsif ($$dataPt =~ /^\{"/) { # JSON PLIST
        $raf and $raf->Seek(0);
        require Image::ExifTool::JSON;
        $result = Image::ExifTool::JSON::ProcessJSON($et, $dirInfo);
    } elsif ($$et{FILE_EXT} and $$et{FILE_EXT} eq 'PLIST' and
        $$dataPt =~ /^\xfe\xff\x00/)
    {
        # (have seen very old PLIST files encoded as UCS-2BE with leading BOM)
        $et->Error('Old PLIST format currently not supported');
        $result = 1;
    }
    return $result;
}

1;  # end

__END__

lib/Image/ExifTool/PNG.pm  view on Meta::CPAN

            if ($$self{VALUE}{FileType} and $$self{VALUE}{FileType} eq "PNG") {
                $$self{VALUE}{FileType} = 'PNG Plus';
            }
            return 1;
        },
        SubDirectory => {
            TagTable => 'Image::ExifTool::FlashPix::Main',
            ProcessProc => 'Image::ExifTool::FlashPix::ProcessFPX',
        },
    },
    meTa => { # XML in UTF-16 BOM format written by Picture It!
        SubDirectory => {
            TagTable => 'Image::ExifTool::XMP::XML',
            IgnoreProp => { meta => 1 }, # ignore 'meta' container
        },
    },
    gdAT => {
        Name => 'GainMapImage',
        Groups => { 2 => 'Preview' },
        Binary => 1,
    },

lib/Image/ExifTool/Text.pm  view on Meta::CPAN

#------------------------------------------------------------------------------
# Extract some stats from a text file
# Inputs: 0) ExifTool ref, 1) dirInfo ref
# Returns: 1 on success, 0 if this wasn't a text file
sub ProcessTXT($$)
{
    my ($et, $dirInfo) = @_;
    my $dataPt = $$dirInfo{TestBuff};
    my $raf = $$dirInfo{RAF};
    my $fast = $et->Options('FastScan') || 0;
    my ($buff, $enc, $isBOM, $isUTF8);
    my $nl = '';

    return 0 unless length $$dataPt; # can't call it a text file if it has no text

    # read more from the file if necessary
    if ($fast < 3 and length($$dataPt) == $Image::ExifTool::testLen) {
        $raf->Read($buff, 65536) or return 0;
        $dataPt = \$buff;
    }
#

lib/Image/ExifTool/Text.pm  view on Meta::CPAN

                $enc = 'utf-16le';
                $nl = $1 if $$dataPt =~ /(\r\0\n|\r|\n)\0/;
            } else {
                $enc = 'utf-16be';
                $nl = $1 if $$dataPt =~ /\0(\r\0\n|\r|\n)/;
            }
        } else {
            return 0;       # probably not a text file
        }
        $nl =~ tr/\0//d;    # remove nulls from newline sequence
        $isBOM = 1;         # (we don't recognize UTF-16/UTF-32 without one)
    } else {
        $isUTF8 = Image::ExifTool::IsUTF8($dataPt, 1);
        if ($isUTF8 == 0) {
            $enc = 'us-ascii';
        } elsif ($isUTF8 > 0) {
            $enc = 'utf-8';
            $isBOM = ($$dataPt =~ /^\xef\xbb\xbf/ ? 1 : 0);
        } elsif ($$dataPt !~ /[\x80-\x9f]/) {
            $enc = 'iso-8859-1';
        } else {
            $enc = 'unknown-8bit';
        }
        $nl = $1 if $$dataPt =~ /(\r\n|\r|\n)/;
    }

    my $tagTablePtr = GetTagTable('Image::ExifTool::Text::Main');

    $et->SetFileType();
    $et->HandleTag($tagTablePtr, MIMEEncoding => $enc);

    return 1 if $fast == 3 or not $raf->Seek(0,0);

    $et->HandleTag($tagTablePtr, ByteOrderMark => $isBOM) if defined $isBOM;
    $et->HandleTag($tagTablePtr, Newlines => $nl);

    return 1 if $fast or not defined $isUTF8;
#
# generate stats for CSV files
#
    if ($$et{FileType} eq 'CSV') {
        my ($delim, $quot, $ncols);
        my $nrows = 0;
        while ($raf->ReadLine($buff)) {

lib/Image/ExifTool/WriteXMP.pl  view on Meta::CPAN

        Write($$dirInfo{OutFile}, $$dataPt) or return -1 if $dataPt and defined $$dataPt;
        return 1;
    }
#
# write out the new XMP information (serialize it)
#
    # start writing the XMP data
    my (@long, @short, @resFlag);
    $long[0] = $long[1] = $short[0] = '';
    if ($$et{XMP_NO_XPACKET}) {
        # write BOM if flag is set
        $long[-2] .= "\xef\xbb\xbf" if $$et{XMP_NO_XPACKET} == 2;
    } else {
        $long[-2] .= $pktOpen;
    }
    $long[-2] .= $xmlOpen if $$et{XMP_IS_XML};
    $long[-2] .= $xmpOpen . $rdfOpen;

    # initialize current property path list
    my (@curPropList, @writeLast, @descStart, $extStart);
    my (%nsCur, $prop, $n, $path);

lib/Image/ExifTool/XMP.pm  view on Meta::CPAN

            $et->Warn("Non-standard XMP at $path", 1);
        } elsif (not $$dirInfo{IsExtended}) {
            $et->Warn("Duplicate XMP at $path") if $$et{DIR_COUNT}{XMP};
            $$et{DIR_COUNT}{XMP} = ($$et{DIR_COUNT}{XMP} || 0) + 1; # count standard XMP
        }
    }
    if ($dataPt) {
        $dirStart = $$dirInfo{DirStart} || 0;
        $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
        $dataLen = $$dirInfo{DataLen} || length($$dataPt);
        # check leading BOM (may indicate double-encoded UTF)
        pos($$dataPt) = $dirStart;
        if ($$dataPt =~ /\G((\0\0)?\xfe\xff|\xff\xfe(\0\0)?|\xef\xbb\xbf)\0*<\0*\?\0*x\0*p\0*a\0*c\0*k\0*e\0*t/g) {
            $double = $1 
        } else {
            # handle UTF-16/32 XML
            pos($$dataPt) = $dirStart;
            if ($$dataPt =~ /\G((\0\0)?\xfe\xff|\xff\xfe(\0\0)?|\xef\xbb\xbf)\0*<\0*\?\0*x\0*m\0*l\0* /g) {
                my $tmp = $1;
                $fmt = $tmp =~ /\xfe\xff/ ? 'n' : 'v';
                $fmt = uc($fmt) if $tmp =~ /\0\0/;

lib/Image/ExifTool/XMP.pm  view on Meta::CPAN

            $raf->Read($buf3, 256) or last; # read more data if available
            $buff .= $buf3;
            $buf3 =~ tr/\0//d;
            $buf2 .= $buf3;
        }
        # check to see if this is XMP format
        # (CS2 writes .XMP files without the "xpacket begin")
        if ($buf2 =~ /^\s*(<\?xpacket begin=|<x(mp)?:x[ma]pmeta)/) {
            $hasXMP = 1;
        } else {
            # also recognize XML files and .XMP files with BOM and without x:xmpmeta
            if ($buf2 =~ /^(\xfe\xff)(<\?xml|<rdf:RDF|<x(mp)?:x[ma]pmeta)/g) {
                $fmt = 'n';     # UTF-16 or 32 MM with BOM
            } elsif ($buf2 =~ /^(\xff\xfe)(<\?xml|<rdf:RDF|<x(mp)?:x[ma]pmeta)/g) {
                $fmt = 'v';     # UTF-16 or 32 II with BOM
            } elsif ($buf2 =~ /^(\xef\xbb\xbf)?(<\?xml|<rdf:RDF|<x(mp)?:x[ma]pmeta|<svg\b)/g) {
                $fmt = 0;       # UTF-8 with BOM or unknown encoding without BOM
            } elsif ($buf2 =~ /^(\xfe\xff|\xff\xfe|\xef\xbb\xbf)(<\?xpacket begin=)/g) {
                $double = $1;   # double-encoded UTF
            } else {
                return 0;       # not recognized XMP or XML
            }
            $bom = 1 if $1;
            if ($2 eq '<?xml') {
                if (defined $fmt and not $fmt and $buf2 =~ /^[^\n\r]*[\n\r]+<\?aid /s) {
                    undef $$et{XmpValidate};    # don't validate INX
                    if ($$et{XMP_CAPTURE}) {

lib/Image/ExifTool/XMP.pm  view on Meta::CPAN

            } elsif ($2 eq '<rdf:RDF') {
                $isRDF = 1;     # recognize XMP without x:xmpmeta element
            } elsif ($2 eq '<svg') {
                $isSVG = $isXML = 1;
            }
            if ($isSVG and $$et{XMP_CAPTURE}) {
                $et->Error("ExifTool does not yet support writing of SVG images");
                return 0;
            }
            if ($buff =~ /^\0\0/) {
                $fmt = 'N';     # UTF-32 MM with or without BOM
            } elsif ($buff =~ /^..\0\0/s) {
                $fmt = 'V';     # UTF-32 II with or without BOM
            } elsif (not $fmt) {
                if ($buff =~ /^\0/) {
                    $fmt = 'n'; # UTF-16 MM without BOM
                } elsif ($buff =~ /^.\0/s) {
                    $fmt = 'v'; # UTF-16 II without BOM
                }
            }
        }
        my $size;
        if ($type) {
            if ($type eq 'PLIST') {
                my $ext = $$et{FILE_EXT};
                $type = $ext if $ext and $ext eq 'MODD';
                $tagTablePtr = GetTagTable('Image::ExifTool::PLIST::Main');
                $$dirInfo{XMPParseOpts}{FoundProc} = \&Image::ExifTool::PLIST::FoundTag;

lib/Image/ExifTool/XMP.pm  view on Meta::CPAN

            $raf->Read($buff, $size) == $size or return 0;
        }
        $dataPt = \$buff;
        $dirStart = 0;
        $dirLen = $dataLen = $size;
    }

    # decode the first layer of double-encoded UTF text (if necessary)
    if ($double) {
        my ($buf2, $fmt);
        $buff = substr($$dataPt, $dirStart + length $double); # remove leading BOM
        Image::ExifTool::SetWarning(undef); # clear old warning
        local $SIG{'__WARN__'} = \&Image::ExifTool::SetWarning;
        # assume that character data has been re-encoded in UTF, so re-pack
        # as characters and look for warnings indicating a false assumption
        if ($double eq "\xef\xbb\xbf") {
            require Image::ExifTool::Charset;
            my $uni = Image::ExifTool::Charset::Decompose(undef,$buff,'UTF8');
            $buf2 = pack('C*', @$uni);
        } else {
            if (length($double) == 2) {
                $fmt = ($double eq "\xfe\xff") ? 'n' : 'v';
            } else {
                $fmt = ($double eq "\0\0\xfe\xff") ? 'N' : 'V';
            }
            $buf2 = pack('C*', unpack("$fmt*",$buff));
        }
        if (Image::ExifTool::GetWarning()) {
            $et->Warn('Superfluous BOM at start of XMP');
            $dataPt = \$buff;   # use XMP with the BOM removed
        } else {
            $et->Warn('XMP is double UTF-encoded');
            $dataPt = \$buf2;   # use the decoded XMP
        }
        $dirStart = 0;
        $dirLen = $dataLen = length $$dataPt;
    }

    # extract XMP/XML as a block if specified
    my $blockName = $$dirInfo{BlockInfo} ? $$dirInfo{BlockInfo}{Name} : 'XMP';



( run in 0.517 second using v1.01-cache-2.11-cpan-e9daa2b36ef )