NAME
Imager - Perl extension for Generating 24 bit Images
SYNOPSIS
# Thumbnail example
#!/usr/bin/perl -w
use strict;
use Imager;
die "Usage: thumbmake.pl filename\n" if !-f $ARGV[0];
my $file = shift;
my $format;
my $img = Imager->new();
$img->open(file=>$file) or die $img->errstr();
$file =~ s/\.[^.]*$//;
# Create smaller version
my $thumb = $img->scale(scalefactor=>.3);
# Autostretch individual channels
$thumb->filter(type=>'autolevels');
# try to save in one of these formats
SAVE:
for $format ( qw( png gif jpg tiff ppm ) ) {
# Check if given format is supported
if ($Imager::formats{$format}) {
$file.="_low.$format";
print "Storing image as: $file\n";
$thumb->write(file=>$file) or
die $thumb->errstr;
last SAVE;
}
}
DESCRIPTION
Imager is a module for creating and altering images. It can read and write various image formats, draw primitive shapes like lines,and polygons, blend multiple images together in various ways, scale, crop, render text and more.
Overview of documentation
- Imager
-
This document - Synopsis Example, Table of Contents and Overview.
- Imager::ImageTypes
-
Basics of constructing image objects with
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. - Imager::Files
-
IO interaction, reading/writing images, format specific tags.
- Imager::Draw
-
Drawing Primitives, lines, boxes, circles, arcs, flood fill.
- Imager::Color
-
Color specification.
- Imager::Fill
-
Fill pattern specification.
- Imager::Font
-
General font rendering, bounding boxes and font metrics.
- Imager::Transformations
-
Copying, scaling, cropping, flipping, blending, pasting, convert and map.
- Imager::Engines
-
Programmable transformations through
transform()
,transform2()
andmatrix_transform()
. - Imager::Filters
-
Filters, sharpen, blur, noise, convolve etc. and filter plugins.
- Imager::Expr
-
Expressions for evaluation engine used by transform2().
- Imager::Matrix2d
-
Helper class for affine transformations.
- Imager::Fountain
-
Helper for making gradient profiles.
Basic Overview
An Image object is created with $img = Imager->new()
. Examples:
$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:
$img=Imager->new(xsize=>400,ysize=>300,channels=>4);
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 $img->errstr()
.
In cases where no image object is associated with an operation $Imager::ERRSTR
is used to report errors not directly associated with an image object.
The Imager->new
method is described in detail in the Imager::ImageTypes manpage.
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 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.rhizomatic.net. As with any IRC channel, the participants could be occupied or asleep, so please be patient.
BUGS
Bugs are listed individually for relevant pod pages.
AUTHOR
Arnar M. Hrafnkelsson (addi@imager.perl.org) and Tony Cook (tony@imager.perl.org) See the README for a complete list.
SEE ALSO
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/~addi/perl/Imager/