package Imager;
use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %formats $DEBUG %filters %DSOs $ERRSTR $fontstate %OPCODES $I2P $FORMATGUESS);
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %formats $DEBUG %filters %DSOs $ERRSTR $fontstate %OPCODES $I2P $FORMATGUESS $warn_obsolete);
use IO::File;
use Imager::Color;
i_img_setmask
i_img_getmask
- i_draw
+ i_line
i_line_aa
i_box
i_box_filled
require Exporter;
require DynaLoader;
- $VERSION = '0.39';
+ $VERSION = '0.43_03';
@ISA = qw(Exporter DynaLoader);
bootstrap Imager $VERSION;
}
};
$FORMATGUESS=\&def_guess_type;
+
+ $warn_obsolete = 1;
}
#
# print Dumper(@_);
#}
+sub init_log {
+ m_init_log($_[0],$_[1]);
+ log_entry("Imager $VERSION starting\n", 1);
+}
+
+
sub init {
my %parms=(loglevel=>1,@_);
if ($parms{'log'}) {
init_log($parms{'log'},$parms{'loglevel'});
}
+ if (exists $parms{'warn_obsolete'}) {
+ $warn_obsolete = $parms{'warn_obsolete'};
+ }
+
# if ($parms{T1LIB_CONFIG}) { $ENV{T1LIB_CONFIG}=$parms{T1LIB_CONFIG}; }
# if ( $ENV{T1LIB_CONFIG} and ( $fontstate eq 'missing conf' )) {
# i_init_fonts();
# $fontstate='ok';
# }
+ if (exists $parms{'t1log'}) {
+ i_init_fonts($parms{'t1log'});
+ }
}
END {
sub _color {
my $arg = shift;
+ # perl 5.6.0 seems to do weird things to $arg if we don't make an
+ # explicitly stringified copy
+ # I vaguely remember a bug on this on p5p, but couldn't find it
+ # through bugs.perl.org (I had trouble getting it to find any bugs)
+ my $copy = $arg . "";
my $result;
if (ref $arg) {
$result = $arg;
}
else {
- if ($arg =~ /^HASH\(/) {
+ if ($copy =~ /^HASH\(/) {
$result = Imager::Color->new(%$arg);
}
- elsif ($arg =~ /^ARRAY\(/) {
+ elsif ($copy =~ /^ARRAY\(/) {
if (grep $_ > 1, @$arg) {
$result = Imager::Color->new(@$arg);
}
$self->{ERRSTR}=undef; #
$self->{DEBUG}=$DEBUG;
$self->{DEBUG} && print "Initialized Imager\n";
- if ($hsh{xsize} && $hsh{ysize}) { $self->img_set(%hsh); }
+ if (defined $hsh{xsize} && defined $hsh{ysize}) {
+ unless ($self->img_set(%hsh)) {
+ $Imager::ERRSTR = $self->{ERRSTR};
+ return;
+ }
+ }
return $self;
}
sub crop {
my $self=shift;
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
- my %hsh=(left=>0,right=>0,top=>0,bottom=>0,@_);
- my ($w,$h,$l,$r,$b,$t)=($self->getwidth(),$self->getheight(),
- @hsh{qw(left right bottom top)});
- $l=0 if not defined $l;
- $t=0 if not defined $t;
+
+ my %hsh=@_;
- $r||=$l+delete $hsh{'width'} if defined $l and exists $hsh{'width'};
- $b||=$t+delete $hsh{'height'} if defined $t and exists $hsh{'height'};
- $l||=$r-delete $hsh{'width'} if defined $r and exists $hsh{'width'};
- $t||=$b-delete $hsh{'height'} if defined $b and exists $hsh{'height'};
+ my ($w, $h, $l, $r, $b, $t) =
+ @hsh{qw(width height left right bottom top)};
- $r=$self->getwidth if not defined $r;
- $b=$self->getheight if not defined $b;
+ # work through the various possibilities
+ if (defined $l) {
+ if (defined $w) {
+ $r = $l + $w;
+ }
+ elsif (!defined $r) {
+ $r = $self->getwidth;
+ }
+ }
+ elsif (defined $r) {
+ if (defined $w) {
+ $l = $r - $w;
+ }
+ else {
+ $l = 0;
+ }
+ }
+ elsif (defined $w) {
+ $l = int(0.5+($self->getwidth()-$w)/2);
+ $r = $l + $w;
+ }
+ else {
+ $l = 0;
+ $r = $self->getwidth;
+ }
+ if (defined $t) {
+ if (defined $h) {
+ $b = $t + $h;
+ }
+ elsif (!defined $b) {
+ $b = $self->getheight;
+ }
+ }
+ elsif (defined $b) {
+ if (defined $h) {
+ $t = $b - $h;
+ }
+ else {
+ $t = 0;
+ }
+ }
+ elsif (defined $h) {
+ $t=int(0.5+($self->getheight()-$h)/2);
+ $b=$t+$h;
+ }
+ else {
+ $t = 0;
+ $b = $self->getheight;
+ }
($l,$r)=($r,$l) if $l>$r;
($t,$b)=($b,$t) if $t>$b;
- if ($hsh{'width'}) {
- $l=int(0.5+($w-$hsh{'width'})/2);
- $r=$l+$hsh{'width'};
- } else {
- $hsh{'width'}=$r-$l;
- }
- if ($hsh{'height'}) {
- $b=int(0.5+($h-$hsh{'height'})/2);
- $t=$h+$hsh{'height'};
- } else {
- $hsh{'height'}=$b-$t;
- }
+ $l < 0 and $l = 0;
+ $r > $self->getwidth and $r = $self->getwidth;
+ $t < 0 and $t = 0;
+ $b > $self->getheight and $b = $self->getheight;
-# print "l=$l, r=$r, h=$hsh{'width'}\n";
-# print "t=$t, b=$b, w=$hsh{'height'}\n";
+ if ($l == $r || $t == $b) {
+ $self->_set_error("resulting image would have no content");
+ return;
+ }
- my $dst=Imager->new(xsize=>$hsh{'width'}, ysize=>$hsh{'height'}, channels=>$self->getchannels());
+ my $dst = $self->_sametype(xsize=>$r-$l, ysize=>$b-$t);
i_copyto($dst->{IMG},$self->{IMG},$l,$t,$r,$b,0,0);
return $dst;
}
+sub _sametype {
+ my ($self, %opts) = @_;
+
+ $self->{IMG} or return $self->_set_error("Not a valid image");
+
+ my $x = $opts{xsize} || $self->getwidth;
+ my $y = $opts{ysize} || $self->getheight;
+ my $channels = $opts{channels} || $self->getchannels;
+
+ my $out = Imager->new;
+ if ($channels == $self->getchannels) {
+ $out->{IMG} = i_sametype($self->{IMG}, $x, $y);
+ }
+ else {
+ $out->{IMG} = i_sametype_chans($self->{IMG}, $x, $y, $channels);
+ }
+ unless ($out->{IMG}) {
+ $self->{ERRSTR} = $self->_error_as_msg;
+ return;
+ }
+
+ return $out;
+}
+
# Sets an image to a certain size and channel number
# if there was previously data in the image it is discarded
$self->{IMG}=Imager::ImgRaw::new($hsh{'xsize'}, $hsh{'ysize'},
$hsh{'channels'});
}
+
+ unless ($self->{IMG}) {
+ $self->{ERRSTR} = Imager->_error_as_msg();
+ return;
+ }
+
+ $self;
}
# created a masked version of the current image
#print "Type ", i_img_type($result->{IMG}), "\n";
- $result->{IMG} or undef $result;
-
- return $result;
+ if ($result->{IMG}) {
+ return $result;
+ }
+ else {
+ $self->{ERRSTR} = $self->_error_as_msg;
+ return;
+ }
}
# convert a paletted (or any image) to an 8-bit/channel RGB images
}
}
-my @needseekcb = qw/tiff/;
-my %needseekcb = map { $_, $_ } @needseekcb;
+sub settag {
+ my ($self, %opts) = @_;
+
+ if ($opts{name}) {
+ $self->deltag(name=>$opts{name});
+ return $self->addtag(name=>$opts{name}, value=>$opts{value});
+ }
+ elsif (defined $opts{code}) {
+ $self->deltag(code=>$opts{code});
+ return $self->addtag(code=>$opts{code}, value=>$opts{value});
+ }
+ else {
+ return undef;
+ }
+}
sub _get_reader_io {
- my ($self, $input, $type) = @_;
+ my ($self, $input) = @_;
- if ($input->{fd}) {
+ if ($input->{io}) {
+ return $input->{io}, undef;
+ }
+ elsif ($input->{fd}) {
return io_new_fd($input->{fd});
}
elsif ($input->{fh}) {
return io_new_buffer($input->{data});
}
elsif ($input->{callback} || $input->{readcb}) {
- if ($needseekcb{$type} && !$input->{seekcb}) {
- $self->_set_error("Format $type needs a seekcb parameter");
+ if (!$input->{seekcb}) {
+ $self->_set_error("Need a seekcb parameter");
}
if ($input->{maxbuffer}) {
return io_new_cb($input->{writecb},
$self->_set_error("Handle in fh option not opened");
return;
}
+ # flush it
+ my $oldfh = select($input->{fh});
+ # flush anything that's buffered, and make sure anything else is flushed
+ $| = 1;
+ select($oldfh);
return io_new_fd($fd);
}
elsif ($input->{file}) {
# has been there for half a year dude.
# Look, i just work here, ok?
- if (!$input{'type'} and $input{file}) {
- $input{'type'}=$FORMATGUESS->($input{file});
- }
+ my ($IO, $fh) = $self->_get_reader_io(\%input) or return;
+
unless ($input{'type'}) {
- $self->_set_error('type parameter missing and not possible to guess from extension');
+ $input{'type'} = i_test_format_probe($IO, -1);
+ }
+
+ unless ($input{'type'}) {
+ $self->_set_error('type parameter missing and not possible to guess from extension');
return undef;
}
- if (!$formats{$input{'type'}}) {
- $self->{ERRSTR}='format not supported'; return undef;
- }
- my %iolready=(jpeg=>1, png=>1, tiff=>1, pnm=>1, raw=>1, bmp=>1, tga=>1, rgb=>1, gif=>1);
-
- if ($iolready{$input{'type'}}) {
- # Setup data source
- my ($IO, $fh) = $self->_get_reader_io(\%input, $input{'type'})
- or return;
-
- if ( $input{'type'} eq 'jpeg' ) {
- ($self->{IMG},$self->{IPTCRAW})=i_readjpeg_wiol( $IO );
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}='unable to read jpeg image'; return undef;
- }
- $self->{DEBUG} && print "loading a jpeg file\n";
- return $self;
+ # Setup data source
+ if ( $input{'type'} eq 'jpeg' ) {
+ ($self->{IMG},$self->{IPTCRAW}) = i_readjpeg_wiol( $IO );
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}='unable to read jpeg image'; return undef;
}
+ $self->{DEBUG} && print "loading a jpeg file\n";
+ return $self;
+ }
- if ( $input{'type'} eq 'tiff' ) {
- $self->{IMG}=i_readtiff_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}=$self->_error_as_msg(); return undef;
- }
- $self->{DEBUG} && print "loading a tiff file\n";
- return $self;
+ if ( $input{'type'} eq 'tiff' ) {
+ $self->{IMG}=i_readtiff_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg(); return undef;
}
+ $self->{DEBUG} && print "loading a tiff file\n";
+ return $self;
+ }
- if ( $input{'type'} eq 'pnm' ) {
- $self->{IMG}=i_readpnm_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}='unable to read pnm image: '._error_as_msg(); return undef;
- }
- $self->{DEBUG} && print "loading a pnm file\n";
- return $self;
+ if ( $input{'type'} eq 'pnm' ) {
+ $self->{IMG}=i_readpnm_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}='unable to read pnm image: '._error_as_msg(); return undef;
}
+ $self->{DEBUG} && print "loading a pnm file\n";
+ return $self;
+ }
- if ( $input{'type'} eq 'png' ) {
- $self->{IMG}=i_readpng_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}='unable to read png image';
- return undef;
- }
- $self->{DEBUG} && print "loading a png file\n";
+ if ( $input{'type'} eq 'png' ) {
+ $self->{IMG}=i_readpng_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}='unable to read png image';
+ return undef;
}
+ $self->{DEBUG} && print "loading a png file\n";
+ }
- if ( $input{'type'} eq 'bmp' ) {
- $self->{IMG}=i_readbmp_wiol( $IO );
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}=$self->_error_as_msg();
- return undef;
- }
- $self->{DEBUG} && print "loading a bmp file\n";
+ if ( $input{'type'} eq 'bmp' ) {
+ $self->{IMG}=i_readbmp_wiol( $IO );
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg();
+ return undef;
}
+ $self->{DEBUG} && print "loading a bmp file\n";
+ }
- if ( $input{'type'} eq 'gif' ) {
- if ($input{colors} && !ref($input{colors})) {
- # must be a reference to a scalar that accepts the colour map
- $self->{ERRSTR} = "option 'colors' must be a scalar reference";
- return undef;
- }
- if ($input{colors}) {
- my $colors;
- ($self->{IMG}, $colors) =i_readgif_wiol( $IO );
- if ($colors) {
- ${ $input{colors} } = [ map { NC(@$_) } @$colors ];
- }
- }
- else {
- $self->{IMG} =i_readgif_wiol( $IO );
- }
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}=$self->_error_as_msg();
- return undef;
+ if ( $input{'type'} eq 'gif' ) {
+ if ($input{colors} && !ref($input{colors})) {
+ # must be a reference to a scalar that accepts the colour map
+ $self->{ERRSTR} = "option 'colors' must be a scalar reference";
+ return undef;
+ }
+ if ($input{colors}) {
+ my $colors;
+ ($self->{IMG}, $colors) =i_readgif_wiol( $IO );
+ if ($colors) {
+ ${ $input{colors} } = [ map { NC(@$_) } @$colors ];
}
- $self->{DEBUG} && print "loading a gif file\n";
}
+ else {
+ $self->{IMG} =i_readgif_wiol( $IO );
+ }
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg();
+ return undef;
+ }
+ $self->{DEBUG} && print "loading a gif file\n";
+ }
- if ( $input{'type'} eq 'tga' ) {
- $self->{IMG}=i_readtga_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}=$self->_error_as_msg();
- return undef;
- }
- $self->{DEBUG} && print "loading a tga file\n";
+ if ( $input{'type'} eq 'tga' ) {
+ $self->{IMG}=i_readtga_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg();
+ return undef;
}
+ $self->{DEBUG} && print "loading a tga file\n";
+ }
- if ( $input{'type'} eq 'rgb' ) {
- $self->{IMG}=i_readrgb_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}=$self->_error_as_msg();
- return undef;
- }
- $self->{DEBUG} && print "loading a tga file\n";
+ if ( $input{'type'} eq 'rgb' ) {
+ $self->{IMG}=i_readrgb_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg();
+ return undef;
}
+ $self->{DEBUG} && print "loading a tga file\n";
+ }
- if ( $input{'type'} eq 'raw' ) {
- my %params=(datachannels=>3,storechannels=>3,interleave=>1,%input);
+ if ( $input{'type'} eq 'raw' ) {
+ my %params=(datachannels=>3,storechannels=>3,interleave=>1,%input);
- if ( !($params{xsize} && $params{ysize}) ) {
- $self->{ERRSTR}='missing xsize or ysize parameter for raw';
- return undef;
- }
+ if ( !($params{xsize} && $params{ysize}) ) {
+ $self->{ERRSTR}='missing xsize or ysize parameter for raw';
+ return undef;
+ }
- $self->{IMG} = i_readraw_wiol( $IO,
- $params{xsize},
- $params{ysize},
- $params{datachannels},
- $params{storechannels},
- $params{interleave});
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}='unable to read raw image';
- return undef;
- }
- $self->{DEBUG} && print "loading a raw file\n";
+ $self->{IMG} = i_readraw_wiol( $IO,
+ $params{xsize},
+ $params{ysize},
+ $params{datachannels},
+ $params{storechannels},
+ $params{interleave});
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}='unable to read raw image';
+ return undef;
}
+ $self->{DEBUG} && print "loading a raw file\n";
+ }
- } else {
+ return $self;
+}
- # Old code for reference while changing the new stuff
+sub _fix_gif_positions {
+ my ($opts, $opt, $msg, @imgs) = @_;
- if (!$input{'type'} and $input{file}) {
- $input{'type'}=$FORMATGUESS->($input{file});
- }
+ my $positions = $opts->{'gif_positions'};
+ my $index = 0;
+ for my $pos (@$positions) {
+ my ($x, $y) = @$pos;
+ my $img = $imgs[$index++];
+ $img->settag(name=>'gif_left', value=>$x);
+ $img->settag(name=>'gif_top', value=>$y) if defined $y;
+ }
+ $$msg .= "replaced with the gif_left and gif_top tags";
+}
- if (!$input{'type'}) {
- $self->{ERRSTR}='type parameter missing and not possible to guess from extension'; return undef;
- }
+my %obsolete_opts =
+ (
+ gif_each_palette=>'gif_local_map',
+ interlace => 'gif_interlace',
+ gif_delays => 'gif_delay',
+ gif_positions => \&_fix_gif_positions,
+ gif_loop_count => 'gif_loop',
+ );
- if (!$formats{$input{'type'}}) {
- $self->{ERRSTR}='format not supported';
- return undef;
- }
+sub _set_opts {
+ my ($self, $opts, $prefix, @imgs) = @_;
- my ($fh, $fd);
- if ($input{file}) {
- $fh = new IO::File($input{file},"r");
- if (!defined $fh) {
- $self->{ERRSTR}='Could not open file';
- return undef;
+ for my $opt (keys %$opts) {
+ my $tagname = $opt;
+ if ($obsolete_opts{$opt}) {
+ my $new = $obsolete_opts{$opt};
+ my $msg = "Obsolete option $opt ";
+ if (ref $new) {
+ $new->($opts, $opt, \$msg, @imgs);
}
- binmode($fh);
- $fd = $fh->fileno();
- }
-
- if ($input{fd}) {
- $fd=$input{fd};
- }
-
- if ( $input{'type'} eq 'gif' ) {
- my $colors;
- if ($input{colors} && !ref($input{colors})) {
- # must be a reference to a scalar that accepts the colour map
- $self->{ERRSTR} = "option 'colors' must be a scalar reference";
- return undef;
+ else {
+ $msg .= "replaced with the $new tag ";
+ $tagname = $new;
}
- if (exists $input{data}) {
- if ($input{colors}) {
- ($self->{IMG}, $colors) = i_readgif_scalar($input{data});
- } else {
- $self->{IMG}=i_readgif_scalar($input{data});
- }
- } else {
- if ($input{colors}) {
- ($self->{IMG}, $colors) = i_readgif( $fd );
- } else {
- $self->{IMG} = i_readgif( $fd )
- }
+ $msg .= "line ".(caller(2))[2]." of file ".(caller(2))[1];
+ warn $msg if $warn_obsolete && $^W;
+ }
+ next unless $tagname =~ /^\Q$prefix/;
+ my $value = $opts->{$opt};
+ if (ref $value) {
+ if (UNIVERSAL::isa($value, "Imager::Color")) {
+ my $tag = sprintf("color(%d,%d,%d,%d)", $value->rgba);
+ for my $img (@imgs) {
+ $img->settag(name=>$tagname, value=>$tag);
+ }
}
- if ($colors) {
- # we may or may not change i_readgif to return blessed objects...
- ${ $input{colors} } = [ map { NC(@$_) } @$colors ];
+ elsif (ref($value) eq 'ARRAY') {
+ for my $i (0..$#$value) {
+ my $val = $value->[$i];
+ if (ref $val) {
+ if (UNIVERSAL::isa($val, "Imager::Color")) {
+ my $tag = sprintf("color(%d,%d,%d,%d)", $value->rgba);
+ $i < @imgs and
+ $imgs[$i]->settag(name=>$tagname, value=>$tag);
+ }
+ else {
+ $self->_set_error("Unknown reference type " . ref($value) .
+ " supplied in array for $opt");
+ return;
+ }
+ }
+ else {
+ $i < @imgs
+ and $imgs[$i]->settag(name=>$tagname, value=>$val);
+ }
+ }
}
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}= 'reading GIF:'._error_as_msg();
- return undef;
+ else {
+ $self->_set_error("Unknown reference type " . ref($value) .
+ " supplied for $opt");
+ return;
+ }
+ }
+ else {
+ # set it as a tag for every image
+ for my $img (@imgs) {
+ $img->settag(name=>$tagname, value=>$value);
}
- $self->{DEBUG} && print "loading a gif file\n";
}
}
- return $self;
+
+ return 1;
}
# Write an image to file
sub write {
my $self = shift;
- my %input=(jpegquality=>75,
- gifquant=>'mc',
- lmdither=>6.0,
+ my %input=(jpegquality=>75,
+ gifquant=>'mc',
+ lmdither=>6.0,
lmfixed=>[],
idstring=>"",
compress=>1,
fax_fine=>1, @_);
my $rc;
- my %iolready=( tiff=>1, raw=>1, png=>1, pnm=>1, bmp=>1, jpeg=>1, tga=>1,
- gif=>1 ); # this will be SO MUCH BETTER once they are all in there
+ $self->_set_opts(\%input, "i_", $self)
+ or return undef;
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
my ($IO, $fh) = $self->_get_writer_io(\%input, $input{'type'})
or return undef;
- # this conditional is probably obsolete
- if ($iolready{$input{'type'}}) {
+ if ($input{'type'} eq 'tiff') {
+ $self->_set_opts(\%input, "tiff_", $self)
+ or return undef;
+ $self->_set_opts(\%input, "exif_", $self)
+ or return undef;
- if ($input{'type'} eq 'tiff') {
- if (defined $input{class} && $input{class} eq 'fax') {
- if (!i_writetiff_wiol_faxable($self->{IMG}, $IO, $input{fax_fine})) {
- $self->{ERRSTR}='Could not write to buffer';
- return undef;
- }
- } else {
- if (!i_writetiff_wiol($self->{IMG}, $IO)) {
- $self->{ERRSTR}='Could not write to buffer';
- return undef;
- }
- }
- } elsif ( $input{'type'} eq 'pnm' ) {
- if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
- $self->{ERRSTR}='unable to write pnm image';
+ if (defined $input{class} && $input{class} eq 'fax') {
+ if (!i_writetiff_wiol_faxable($self->{IMG}, $IO, $input{fax_fine})) {
+ $self->{ERRSTR}='Could not write to buffer';
return undef;
}
- $self->{DEBUG} && print "writing a pnm file\n";
- } elsif ( $input{'type'} eq 'raw' ) {
- if ( !i_writeraw_wiol($self->{IMG},$IO) ) {
- $self->{ERRSTR}='unable to write raw image';
+ } else {
+ if (!i_writetiff_wiol($self->{IMG}, $IO)) {
+ $self->{ERRSTR}='Could not write to buffer';
return undef;
}
- $self->{DEBUG} && print "writing a raw file\n";
- } elsif ( $input{'type'} eq 'png' ) {
- if ( !i_writepng_wiol($self->{IMG}, $IO) ) {
- $self->{ERRSTR}='unable to write png image';
- return undef;
- }
- $self->{DEBUG} && print "writing a png file\n";
- } elsif ( $input{'type'} eq 'jpeg' ) {
- if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
- $self->{ERRSTR} = $self->_error_as_msg();
- return undef;
- }
- $self->{DEBUG} && print "writing a jpeg file\n";
- } elsif ( $input{'type'} eq 'bmp' ) {
- if ( !i_writebmp_wiol($self->{IMG}, $IO) ) {
- $self->{ERRSTR}='unable to write bmp image';
- return undef;
- }
- $self->{DEBUG} && print "writing a bmp file\n";
- } elsif ( $input{'type'} eq 'tga' ) {
-
- if ( !i_writetga_wiol($self->{IMG}, $IO, $input{wierdpack}, $input{compress}, $input{idstring}) ) {
- $self->{ERRSTR}=$self->_error_as_msg();
- return undef;
- }
- $self->{DEBUG} && print "writing a tga file\n";
- } elsif ( $input{'type'} eq 'gif' ) {
- # compatibility with the old interfaces
- if ($input{gifquant} eq 'lm') {
- $input{make_colors} = 'addi';
- $input{translate} = 'perturb';
- $input{perturb} = $input{lmdither};
- } elsif ($input{gifquant} eq 'gen') {
- # just pass options through
- } else {
- $input{make_colors} = 'webmap'; # ignored
- $input{translate} = 'giflib';
- }
- $rc = i_writegif_wiol($IO, \%input, $self->{IMG});
}
+ } elsif ( $input{'type'} eq 'pnm' ) {
+ $self->_set_opts(\%input, "pnm_", $self)
+ or return undef;
+ if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
+ $self->{ERRSTR}='unable to write pnm image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a pnm file\n";
+ } elsif ( $input{'type'} eq 'raw' ) {
+ $self->_set_opts(\%input, "raw_", $self)
+ or return undef;
+ if ( !i_writeraw_wiol($self->{IMG},$IO) ) {
+ $self->{ERRSTR}='unable to write raw image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a raw file\n";
+ } elsif ( $input{'type'} eq 'png' ) {
+ $self->_set_opts(\%input, "png_", $self)
+ or return undef;
+ if ( !i_writepng_wiol($self->{IMG}, $IO) ) {
+ $self->{ERRSTR}='unable to write png image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a png file\n";
+ } elsif ( $input{'type'} eq 'jpeg' ) {
+ $self->_set_opts(\%input, "jpeg_", $self)
+ or return undef;
+ $self->_set_opts(\%input, "exif_", $self)
+ or return undef;
+ if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
+ $self->{ERRSTR} = $self->_error_as_msg();
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a jpeg file\n";
+ } elsif ( $input{'type'} eq 'bmp' ) {
+ $self->_set_opts(\%input, "bmp_", $self)
+ or return undef;
+ if ( !i_writebmp_wiol($self->{IMG}, $IO) ) {
+ $self->{ERRSTR}='unable to write bmp image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a bmp file\n";
+ } elsif ( $input{'type'} eq 'tga' ) {
+ $self->_set_opts(\%input, "tga_", $self)
+ or return undef;
- if (exists $input{'data'}) {
- my $data = io_slurp($IO);
- if (!$data) {
- $self->{ERRSTR}='Could not slurp from buffer';
- return undef;
- }
- ${$input{data}} = $data;
+ if ( !i_writetga_wiol($self->{IMG}, $IO, $input{wierdpack}, $input{compress}, $input{idstring}) ) {
+ $self->{ERRSTR}=$self->_error_as_msg();
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a tga file\n";
+ } elsif ( $input{'type'} eq 'gif' ) {
+ $self->_set_opts(\%input, "gif_", $self)
+ or return undef;
+ # compatibility with the old interfaces
+ if ($input{gifquant} eq 'lm') {
+ $input{make_colors} = 'addi';
+ $input{translate} = 'perturb';
+ $input{perturb} = $input{lmdither};
+ } elsif ($input{gifquant} eq 'gen') {
+ # just pass options through
+ } else {
+ $input{make_colors} = 'webmap'; # ignored
+ $input{translate} = 'giflib';
+ }
+ if (!i_writegif_wiol($IO, \%input, $self->{IMG})) {
+ $self->{ERRSTR} = $self->_error_as_msg;
+ return;
}
- return $self;
}
+ if (exists $input{'data'}) {
+ my $data = io_slurp($IO);
+ if (!$data) {
+ $self->{ERRSTR}='Could not slurp from buffer';
+ return undef;
+ }
+ ${$input{data}} = $data;
+ }
return $self;
}
$class->_set_error('Usage: Imager->write_multi({ options }, @images)');
return 0;
}
+ $class->_set_opts($opts, "i_", @images)
+ or return;
my @work = map $_->{IMG}, @images;
my ($IO, $file) = $class->_get_writer_io($opts, $opts->{'type'})
or return undef;
if ($opts->{'type'} eq 'gif') {
+ $class->_set_opts($opts, "gif_", @images)
+ or return;
my $gif_delays = $opts->{gif_delays};
local $opts->{gif_delays} = $gif_delays;
if ($opts->{gif_delays} && !ref $opts->{gif_delays}) {
return $res;
}
elsif ($opts->{'type'} eq 'tiff') {
+ $class->_set_opts($opts, "tiff_", @images)
+ or return;
+ $class->_set_opts($opts, "exif_", @images)
+ or return;
my $res;
$opts->{fax_fine} = 1 unless exists $opts->{fax_fine};
if ($opts->{'class'} && $opts->{'class'} eq 'fax') {
my $img = Imager->new();
my $tmp = Imager->new();
+ unless (defined wantarray) {
+ my @caller = caller;
+ warn "scale() called in void context - scale() returns the scaled image at $caller[1] line $caller[2]\n";
+ return;
+ }
+
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
if ($opts{xpixels} and $opts{ypixels} and $opts{'type'}) {
$Imager::ERRSTR = Imager::Expr::error();
return;
}
+ my $channels = $opts->{channels} || 3;
+ unless ($channels >= 1 && $channels <= 4) {
+ return Imager->_set_error("channels must be an integer between 1 and 4");
+ }
my $img = Imager->new();
- $img->{IMG} = i_transform2($opts->{width}, $opts->{height}, $code->code(),
+ $img->{IMG} = i_transform2($opts->{width}, $opts->{height},
+ $channels, $code->code(),
$code->nregs(), $code->cregs(),
[ map { $_->{IMG} } @imgs ]);
if (!defined $img->{IMG}) {
sub rubthrough {
my $self=shift;
- my %opts=(tx=>0,ty=>0,@_);
+ my %opts=(tx => 0,ty => 0, @_);
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
unless ($opts{src} && $opts{src}->{IMG}) { $self->{ERRSTR}='empty input image for source'; return undef; }
- unless (i_rubthru($self->{IMG}, $opts{src}->{IMG}, $opts{tx},$opts{ty})) {
+ %opts = (src_minx => 0,
+ src_miny => 0,
+ src_maxx => $opts{src}->getwidth(),
+ src_maxy => $opts{src}->getheight(),
+ %opts);
+
+ unless (i_rubthru($self->{IMG}, $opts{src}->{IMG}, $opts{tx}, $opts{ty},
+ $opts{src_minx}, $opts{src_miny}, $opts{src_maxx}, $opts{src_maxy})) {
$self->{ERRSTR} = $self->_error_as_msg();
return undef;
}
my $amount = $opts{radians} || $opts{degrees} * 3.1415926535 / 180;
my $result = Imager->new;
- if ($result->{IMG} = i_rotate_exact($self->{IMG}, $amount)) {
+ if ($opts{back}) {
+ $result->{IMG} = i_rotate_exact($self->{IMG}, $amount, $opts{back});
+ }
+ else {
+ $result->{IMG} = i_rotate_exact($self->{IMG}, $amount);
+ }
+ if ($result->{IMG}) {
return $result;
}
else {
}
}
else {
- $self->{ERRSTR} = "Only the 'right' parameter is available";
+ $self->{ERRSTR} = "Only the 'right', 'radians' and 'degrees' parameters are available";
return undef;
}
}
my $ysize = $opts{ysize} || $self->getheight;
my $result = Imager->new;
- $result->{IMG} = i_matrix_transform($self->{IMG}, $xsize, $ysize,
- $opts{matrix})
- or return undef;
+ if ($opts{back}) {
+ $result->{IMG} = i_matrix_transform($self->{IMG}, $xsize, $ysize,
+ $opts{matrix}, $opts{back})
+ or return undef;
+ }
+ else {
+ $result->{IMG} = i_matrix_transform($self->{IMG}, $xsize, $ysize,
+ $opts{matrix})
+ or return undef;
+ }
return $result;
}
return $self;
}
-# Draws a line from one point to (but not including) the destination point
+# Draws a line from one point to the other
+# the endpoint is set if the endp parameter is set which it is by default.
+# to turn of the endpoint being set use endp=>0 when calling line.
sub line {
my $self=shift;
my $dflcl=i_color_new(0,0,0,0);
- my %opts=(color=>$dflcl,@_);
+ my %opts=(color=>$dflcl,
+ endp => 1,
+ @_);
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
unless (exists $opts{x1} and exists $opts{y1}) { $self->{ERRSTR}='missing begining coord'; return undef; }
unless (exists $opts{x2} and exists $opts{y2}) { $self->{ERRSTR}='missing ending coord'; return undef; }
my $color = _color($opts{'color'});
- unless ($color) {
- $self->{ERRSTR} = $Imager::ERRSTR;
- return;
+ unless ($color) {
+ $self->{ERRSTR} = $Imager::ERRSTR;
+ return;
}
+
$opts{antialias} = $opts{aa} if defined $opts{aa};
if ($opts{antialias}) {
- i_line_aa($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
- $color);
+ i_line_aa($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
+ $color, $opts{endp});
} else {
- i_draw($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
- $color);
+ i_line($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
+ $color, $opts{endp});
}
return $self;
}
if ($opts{antialias}) {
for $pt(@points) {
if (defined($ls)) {
- i_line_aa($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color);
+ i_line_aa($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color, 1);
}
$ls=$pt;
}
} else {
for $pt(@points) {
if (defined($ls)) {
- i_draw($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color);
+ i_line($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color,1);
}
$ls=$pt;
}
sub flood_fill {
my $self = shift;
my %opts = ( color=>Imager::Color->new(255, 255, 255), @_ );
+ my $rc;
unless (exists $opts{'x'} && exists $opts{'y'}) {
$self->{ERRSTR} = "missing seed x and y parameters";
return;
}
}
- i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
+ $rc = i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
}
else {
my $color = _color($opts{'color'});
- unless ($color) {
- $self->{ERRSTR} = $Imager::ERRSTR;
- return;
+ unless ($color) {
+ $self->{ERRSTR} = $Imager::ERRSTR;
+ return;
}
- i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
+ $rc = i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
}
-
- $self;
+ if ($rc) { $self; } else { $self->{ERRSTR} = $self->_error_as_msg(); return (); }
}
sub setpixel {
or return undef;
if (ref $x && ref $y) {
unless (@$x == @$y) {
- $self->{ERRSTR} = 'length of x and y mistmatch';
+ $self->{ERRSTR} = 'length of x and y mismatch';
return undef;
}
if ($color->isa('Imager::Color')) {
sub getpixel {
my $self = shift;
- my %opts = ( type=>'8bit', @_);
+ my %opts = ( "type"=>'8bit', @_);
unless (exists $opts{'x'} && exists $opts{'y'}) {
$self->{ERRSTR} = 'missing x and y parameters';
return undef;
}
my @result;
- if ($opts{type} eq '8bit') {
+ if ($opts{"type"} eq '8bit') {
for my $i (0..$#{$opts{'x'}}) {
push(@result, i_get_pixel($self->{IMG}, $x->[$i], $y->[$i]));
}
return wantarray ? @result : \@result;
}
else {
- if ($opts{type} eq '8bit') {
+ if ($opts{"type"} eq '8bit') {
return i_get_pixel($self->{IMG}, $x, $y);
}
else {
return $self;
}
+sub difference {
+ my ($self, %opts) = @_;
+
+ defined $opts{mindist} or $opts{mindist} = 0;
+
+ defined $opts{other}
+ or return $self->_set_error("No 'other' parameter supplied");
+ defined $opts{other}{IMG}
+ or return $self->_set_error("No image data in 'other' image");
+
+ $self->{IMG}
+ or return $self->_set_error("No image data");
+
+ my $result = Imager->new;
+ $result->{IMG} = i_diff_image($self->{IMG}, $opts{other}{IMG},
+ $opts{mindist})
+ or return $self->_set_error($self->_error_as_msg());
+
+ return $result;
+}
+
# destructive border - image is shrunk by one pixel all around
sub border {
else {
$ERRSTR = $msg;
}
+ return;
}
# Default guess for the type of an image from extension
my $format;
my $img = Imager->new();
+ # see Imager::Files for information on the open() method
$img->open(file=>$file) or die $img->errstr();
$file =~ s/\.[^.]*$//;
# Create smaller version
+ # documented in Imager::Transformations
my $thumb = $img->scale(scalefactor=>.3);
# Autostretch individual channels
if ($Imager::formats{$format}) {
$file.="_low.$format";
print "Storing image as: $file\n";
+ # documented in Imager::Files
$thumb->write(file=>$file) or
die $thumb->errstr;
last SAVE;
}
}
-
- # Logo Generator Example
-
-
-
=head1 DESCRIPTION
Imager is a module for creating and altering images. It can read and
=over
-=item Imager
+=item *
-This document - Synopsis Example, Table of Contents and Overview.
+Imager - This document - Synopsis Example, Table of Contents and
+Overview.
-=item Imager::ImageTypes
+=item *
-Direct type/virtual images, RGB(A)/paletted images, 8/16/double
-bits/channel, color maps, channel masks, image tags, color
-quantization.
+L<Imager::ImageTypes> - Basics of constructing image objects with
+C<new()>: Direct type/virtual images, RGB(A)/paletted images,
+8/16/double bits/channel, color maps, channel masks, image tags, color
+quantization. Also discusses basic image information methods.
-=item Imager::Files
+=item *
-IO interaction, reading/writing images, format specific tags.
+L<Imager::Files> - IO interaction, reading/writing images, format
+specific tags.
-=item Imager::Draw
+=item *
-Drawing Primitives, lines, boxes, circles, arcs, flood fill.
+L<Imager::Draw> - Drawing Primitives, lines, boxes, circles, arcs,
+flood fill.
-=item Imager::Color
+=item *
-Color specification.
+L<Imager::Color> - Color specification.
-=item Imager::Color
+=item *
-Fill pattern specification.
+L<Imager::Fill> - Fill pattern specification.
-=item Imager::Font
+=item *
-General font rendering, bounding boxes and font metrics.
+L<Imager::Font> - General font rendering, bounding boxes and font
+metrics.
-=item Imager::Transformations
+=item *
-Copying, scaling, cropping, flipping, blending, pasting, convert and
-map.
+L<Imager::Transformations> - Copying, scaling, cropping, flipping,
+blending, pasting, convert and map.
-=item Imager::Engines
+=item *
-transform2 and matrix_transform.
+L<Imager::Engines> - Programmable transformations through
+C<transform()>, C<transform2()> and C<matrix_transform()>.
-=item Imager::Filters
+=item *
-Filters, sharpen, blur, noise, convolve etc. and filter plugins.
+L<Imager::Filters> - Filters, sharpen, blur, noise, convolve etc. and
+filter plugins.
-=item Imager::Expr
+=item *
-Expressions for evaluation engine used by transform2().
+L<Imager::Expr> - Expressions for evaluation engine used by
+transform2().
-=item Imager::Matrix2d
+=item *
-Helper class for affine transformations.
+L<Imager::Matrix2d> - Helper class for affine transformations.
-=item Imager::Fountain
+=item *
-Helper for making gradient profiles.
+L<Imager::Fountain> - Helper for making gradient profiles.
=back
-
-
-
-
=head2 Basic Overview
-An Image object is created with C<$img = Imager-E<gt>new()> Should
-this fail for some reason an explanation can be found in
-C<$Imager::ERRSTR> usually error messages are stored in
-C<$img-E<gt>{ERRSTR}>, but since no object is created this is the only
-way to give back errors. C<$Imager::ERRSTR> is also used to report
-all errors not directly associated with an image object. Examples:
+An Image object is created with C<$img = Imager-E<gt>new()>.
+Examples:
- $img=Imager->new(); # This is an empty image (size is 0 by 0)
- $img->open(file=>'lena.png',type=>'png'); # initializes from file
+ $img=Imager->new(); # create empty image
+ $img->open(file=>'lena.png',type=>'png') or # read image from file
+ die $img->errstr(); # give an explanation
+ # if something failed
or if you want to create an empty image:
This example creates a completely black image of width 400 and height
300 and 4 channels.
+When an operation fails which can be directly associated with an image
+the error message is stored can be retrieved with
+C<$img-E<gt>errstr()>.
+
+In cases where no image object is associated with an operation
+C<$Imager::ERRSTR> is used to report errors not directly associated
+with an image object.
+
+The C<Imager-E<gt>new> method is described in detail in
+L<Imager::ImageTypes>.
+
+=head1 METHOD INDEX
+
+Where to find information on methods for Imager class objects.
+
+addcolors() - L<Imager::ImageTypes>
+
+addtag() - L<Imager::ImageTypes> - add image tags
+
+arc() - L<Imager::Draw/arc>
+
+bits() - L<Imager::ImageTypes> - number of bits per sample for the
+image
+
+box() - L<Imager::Draw/box>
+
+circle() - L<Imager::Draw/circle>
+
+convert() - L<Imager::Transformations/"Color transformations"> -
+transform the color space
+
+copy() - L<Imager::Transformations/copy>
+
+crop() - L<Imager::Transformations/crop> - extract part of an image
+
+deltag() - L<Imager::ImageTypes> - delete image tags
+
+difference() - L<Imager::Filters/"Image Difference">
+
+filter() - L<Imager::Filters>
+
+findcolor() - L<Imager::ImageTypes> - search the image palette, if it
+has one
+
+flip() - L<Imager::Transformations/flip>
+
+flood_fill() - L<Imager::Draw/flood_fill>
+
+getchannels() - L<Imager::ImageTypes>
+
+getcolorcount() - L<Imager::ImageTypes>
+
+getcolors() - L<Imager::ImageTypes> - get colors from the image
+palette, if it has one
+
+getheight() - L<Imager::ImageTypes>
+getpixel() - L<Imager::Draw/setpixel and getpixel>
+getwidth() - L<Imager::ImageTypes>
+
+img_set() - L<Imager::ImageTypes>
+
+line() - L<Imager::Draw/line>
+
+map() - L<Imager::Transformations/"Color Mappings"> - remap color
+channel values
+
+masked() - L<Imager::ImageTypes> - make a masked image
+
+matrix_transform() - L<Imager::Engines/"Matrix Transformations">
+
+new() - L<Imager::ImageTypes>
+
+paste() - L<Imager::Transformations/paste> - draw an image onto an image
+
+polygon() - L<Imager::Draw/polygon>
+
+polyline() - L<Imager::Draw/polyline>
+
+read() - L<Imager::Files>
+
+read_multi() - L<Imager::Files>
+
+rotate() - L<Imager::Transformations/rotate>
+
+rubthrough() - L<Imager::Transformations/rubthrough> - draw an image onto an
+image and use the alpha channel
+
+scale() - L<Imager::Transformations/scale>
+
+setcolors() - L<Imager::ImageTypes> - set palette colors in a paletted image
+
+setpixel() - L<Imager::Draw/setpixel and getpixel>
+
+string() - L<Imager::Font/string> - draw text on an image
+
+tags() - L<Imager::ImageTypes> - fetch image tags
+
+to_paletted() - L<Imager::ImageTypes>
+
+to_rgb8() - L<Imager::ImageTypes>
+
+transform() - L<Imager::Engines/"transform">
+
+transform2() - L<Imager::Engines/"transform2">
+
+type() - L<Imager::ImageTypes> - type of image (direct vs paletted)
+
+virtual() - L<Imager::ImageTypes> - whether the image has it's own
+data
+
+write() - L<Imager::Files>
+
+write_multi() - L<Imager::Files>
+
+=head1 SUPPORT
+
+You can ask for help, report bugs or express your undying love for
+Imager on the Imager-devel mailing list.
+
+To subscribe send a message with C<subscribe> in the body to:
+
+ imager-devel+request@molar.is
+
+or use the form at:
+
+ http://www.molar.is/en/lists/imager-devel/
+ (annonymous is temporarily off due to spam)
+
+where you can also find the mailing list archive.
+
+If you're into IRC, you can typically find the developers in #Imager
+on irc.perl.org. As with any IRC channel, the participants could be
+occupied or asleep, so please be patient.
+
+You can report bugs either by sending email to:
+
+ bug-Imager@rt.cpan.org
+
+or by pointing your browser at:
+
+ https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Imager
+
+Please remember to include the versions of Imager, perl, supporting
+libraries, and any relevant code. If you have specific images that
+cause the problems, please include those too.
=head1 BUGS
=head1 AUTHOR
-Arnar M. Hrafnkelsson (addi@umich.edu) and Tony Cook (XXX) See the
-README for a complete list.
+Arnar M. Hrafnkelsson (addi@imager.perl.org) and Tony Cook
+(tony@imager.perl.org) See the README for a complete list.
=head1 SEE ALSO
-perl(1), Imager::Color(3), Imager::Font(3), Imager::Matrix2d(3),
-Affix::Infix2Postfix(3), Parse::RecDescent(3)
-http://www.eecs.umich.edu/~addi/perl/Imager/
+perl(1), Imager::ImageTypes(3), Imager::Files(3), Imager::Draw(3),
+Imager::Color(3), Imager::Fill(3), Imager::Font(3),
+Imager::Transformations(3), Imager::Engines(3), Imager::Filters(3),
+Imager::Expr(3), Imager::Matrix2d(3), Imager::Fountain(3)
+
+Affix::Infix2Postfix(3), Parse::RecDescent(3)
+http://imager.perl.org/
=cut