Photoshop.pm (Image-ExifTool-12.57) | : | Photoshop.pm (Image-ExifTool-12.58) | ||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
# 6) http://libpsd.graphest.com/files/Photoshop%20File%20Formats.p df | # 6) http://libpsd.graphest.com/files/Photoshop%20File%20Formats.p df | |||
# 7) http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ | # 7) http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ | |||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | |||
package Image::ExifTool::Photoshop; | package Image::ExifTool::Photoshop; | |||
use strict; | use strict; | |||
use vars qw($VERSION $AUTOLOAD $iptcDigestInfo %printFlags); | use vars qw($VERSION $AUTOLOAD $iptcDigestInfo %printFlags); | |||
use Image::ExifTool qw(:DataAccess :Utils); | use Image::ExifTool qw(:DataAccess :Utils); | |||
$VERSION = '1.68'; | $VERSION = '1.69'; | |||
sub ProcessPhotoshop($$$); | sub ProcessPhotoshop($$$); | |||
sub WritePhotoshop($$$); | sub WritePhotoshop($$$); | |||
sub ProcessLayers($$$); | sub ProcessLayers($$$); | |||
# PrintFlags bit definitions (ref forum13785) | # PrintFlags bit definitions (ref forum13785) | |||
%printFlags = ( | %printFlags = ( | |||
0 => 'Labels', | 0 => 'Labels', | |||
1 => 'Corner crop marks', | 1 => 'Corner crop marks', | |||
2 => 'Color bars', # (deprecated) | 2 => 'Color bars', # (deprecated) | |||
skipping to change at line 77 | skipping to change at line 77 | |||
# tag information for PhotoshopThumbnail and PhotoshopBGRThumbnail | # tag information for PhotoshopThumbnail and PhotoshopBGRThumbnail | |||
my %thumbnailInfo = ( | my %thumbnailInfo = ( | |||
Writable => 'undef', | Writable => 'undef', | |||
Protected => 1, | Protected => 1, | |||
RawConv => 'my $img=substr($val,0x1c); $self->ValidateImage(\$img,$tag)', | RawConv => 'my $img=substr($val,0x1c); $self->ValidateImage(\$img,$tag)', | |||
ValueConvInv => q{ | ValueConvInv => q{ | |||
my $et = new Image::ExifTool; | my $et = new Image::ExifTool; | |||
my @tags = qw{ImageWidth ImageHeight FileType}; | my @tags = qw{ImageWidth ImageHeight FileType}; | |||
my $info = $et->ImageInfo(\$val, @tags); | my $info = $et->ImageInfo(\$val, @tags); | |||
my ($w, $h, $type) = @$info{@tags}; | my ($w, $h, $type) = @$info{@tags}; | |||
$w and $h and $type eq 'JPEG' or warn("Not a valid JPEG image\n"), retur n undef; | $w and $h and $type and $type eq 'JPEG' or warn("Not a valid JPEG image\ n"), return undef; | |||
my $wbytes = int(($w * 24 + 31) / 32) * 4; | my $wbytes = int(($w * 24 + 31) / 32) * 4; | |||
return pack('N6n2', 1, $w, $h, $wbytes, $wbytes * $h, length($val), 24, 1) . $val; | return pack('N6n2', 1, $w, $h, $wbytes, $wbytes * $h, length($val), 24, 1) . $val; | |||
}, | }, | |||
); | ); | |||
# tag info to decode Photoshop Unicode string | # tag info to decode Photoshop Unicode string | |||
my %unicodeString = ( | my %unicodeString = ( | |||
ValueConv => sub { | ValueConv => sub { | |||
my ($val, $et) = @_; | my ($val, $et) = @_; | |||
return '<err>' if length($val) < 4; | return '<err>' if length($val) < 4; | |||
skipping to change at line 708 | skipping to change at line 708 | |||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | |||
# Process Photoshop layers and mask information section of PSD/PSB file | # Process Photoshop layers and mask information section of PSD/PSB file | |||
# Inputs: 0) ExifTool ref, 1) DirInfo ref, 2) tag table ref | # Inputs: 0) ExifTool ref, 1) DirInfo ref, 2) tag table ref | |||
# Returns: 1 on success (and seeks to the end of this section) | # Returns: 1 on success (and seeks to the end of this section) | |||
sub ProcessLayersAndMask($$$) | sub ProcessLayersAndMask($$$) | |||
{ | { | |||
local $_; | local $_; | |||
my ($et, $dirInfo, $tagTablePtr) = @_; | my ($et, $dirInfo, $tagTablePtr) = @_; | |||
my $raf = $$dirInfo{RAF}; | my $raf = $$dirInfo{RAF}; | |||
my $fileType = $$et{VALUE}{FileType}; | my $fileType = $$et{FileType}; | |||
my $data; | my $data; | |||
return 0 unless $fileType eq 'PSD' or $fileType eq 'PSB'; # (no layer sect ion in CS1 files) | return 0 unless $fileType eq 'PSD' or $fileType eq 'PSB'; # (no layer sect ion in CS1 files) | |||
# (some words are 4 bytes in PSD files and 8 bytes in PSB) | # (some words are 4 bytes in PSD files and 8 bytes in PSB) | |||
my ($psb, $psiz) = $fileType eq 'PSB' ? (1, 8) : (undef, 4); | my ($psb, $psiz) = $fileType eq 'PSB' ? (1, 8) : (undef, 4); | |||
# read the layer information header | # read the layer information header | |||
my $n = $psiz * 2 + 2; | my $n = $psiz * 2 + 2; | |||
$raf->Read($data, $n) == $n or return 0; | $raf->Read($data, $n) == $n or return 0; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |