Imager::ImageTypes is a Perl module that contains image models for Imager.
SYNOPSIS
use Imager;
$img = Imager->new(); # Empty image (size is 0 by 0)
$img->open(file=>'lena.png',type=>'png'); # Read image from file
$img = Imager->new(xsize=>400, ysize=>300); # RGB data
$img = Imager->new(xsize=>400, ysize=>300, # Grayscale
channels=>1); #
$img = Imager->new(xsize=>400, ysize=>300, # RGB with alpha
channels=>4); #
$img = Imager->new(xsize=>200, ysize=>200,
type=>'paletted'); # paletted image
$img = Imager->new(xsize=>200, ysize=>200,
bits=>16); # 16 bits/channel rgb
$img = Imager->new(xsize=>200, ysize=>200,
bits=>'double'); # 'double' floating point
# per channel
$img->img_set(xsize=>500, ysize=>500, # reset the image object
channels=>4);
# Example getting information about an Imager object
print "Image information:n";
print "Width: ", $img->getwidth(), "n";
print "Height: ", $img->getheight(), "n";
print "Channels: ", $img->getchannels(), "n";
print "Bits/Channel: ", $img->bits(), "n";
print "Virtual: ", $img->virtual() ? "Yes" : "No", "n";
my $colorcount = $img->getcolorcount(maxcolors=>512);
print "Actual number of colors in image: ";
print defined($colorcount) ? $colorcount : ">512", "n";
print "Type: ", $img->type(), "n";
if ($img->type() eq 'direct') {
print "Modifiable Channels: ";
print join " ", map {
($img->getmask() & 1colorcount;
@colors = $img->getcolors();
print "Palette size: $countn";
my $mx = @colors > 4 ? 4 : 0+@colors;
print "First $mx entries:n";
for (@colors[0..$mx-1]) {
my @res = $_->rgba();
print "(", join(", ", @res[0..$img->getchannels()-1]), ")n";
}
}
my @tags = $img->tags();
if (@tags) {
print "Tags:n";
for(@tags) {
print shift @$_, ": ", join " ", @$_, "n";
}
} else {
print "No tags in imagen";
}
Requirements:
· Perl
Product's homepage
Requirements:
· Perl