%Image::ExifTool::UserDefined = ( 'Image::ExifTool::PNG::Main' => { PLTE => { Name => 'Palette', ValueConv => q{ my $str = '[' . join(', ', unpack('C*',$val)) . ']'; $str =~ s/(\d+, \d+, \d+)/($1)/g; return $str; }, }, }, 'Image::ExifTool::Composite' => { PNGTransparency => { Require => { 0 => 'PNG:Transparency', 1 => 'PNG:ColorType', }, ValueConv => q{ my @transparencyData = unpack('C*', $val[0]); if ($val[1] == 3) { # Indexed-color/palette return '[' . join(',', @transparencyData) . ']'; } elsif ($val[1] == 0) { # Grayscale # Unpack as a single 2-byte value my ($transparency) = unpack('n', $val[0]); return $transparency; } elsif ($val[1] == 2) { # RGB # Unpack the first three 2-byte values from transparency data my @rgbaTransparency = unpack('n3', $val[0]); return '[' . join(',', @rgbaTransparency) . ']'; } return ''; }, }, }, ); 1;