/usr/share/perl5/Image/Info/ICO.pm is in libimage-info-perl 1.41-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | package Image::Info::ICO;
$VERSION = '0.02';
# Copyright (C) 2009 Slaven Rezic. All rights reserved.
# This package is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
use strict;
sub process_file {
my($info, $fh) = @_;
my $buf;
if (read($fh, $buf, 6) != 6) {
$info->push_info(0, 'error' => 'Short read (expected at least 6 bytes)');
return;
}
$info->push_info(0, 'file_media_type' => 'image/x-icon'); # XXX or is there already an official vnd format?
$info->push_info(0, 'file_ext' => 'ico');
my($no_icons) = unpack('v', substr($buf, 4, 2));
for my $img_no (0 .. $no_icons-1) {
if (read($fh, $buf, 16) != 16) {
$info->push_info(0, 'error' => "Short read while getting information for image at index $img_no");
return;
}
my($width,
$height,
$colors,
undef, # reserved
undef, # $planes
undef, # $bitcount
undef, # $size_in_bytes
undef, # $file_offset
) = unpack('CCCCvvVV', $buf);
if ($colors == 0) { $colors = 256 }
$info->push_info($img_no, 'width', $width);
$info->push_info($img_no, 'height', $height);
$info->push_info($img_no, 'color_type', 'Indexed-RGB');
$info->push_info($img_no, 'colors', $colors);
}
}
1;
__END__
=head1 NAME
Image::Info::ICO - Microsoft ICO support for Image::Info
=head1 NOTES
This module adds only support for MS Icon files, but not for cursor
files.
=head1 AUTHOR
Slaven Rezic
=head1 SEE ALSO
L<Image::Info>
=begin register
MAGIC: /^\000\000\001\000/
This module supports the Microsoft Windows Icon Resource format
(.ico).
=end register
=cut
|