Imager - Perl extension for Generating 24 bit Images # 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; } } 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
This document - Synopsis Example, Table of Contents and Overview. Direct type/virtual images, RGB(A)/paletted images, 8/16/double bits/channel, color maps, channel masks, image tags, color quantization. IO interaction, reading/writing images, format specific tags. Drawing Primitives, lines, boxes, circles, arcs, flood fill. Color specification. Fill pattern specification. General font rendering, bounding boxes and font metrics. Copying, scaling, cropping, flipping, blending, pasting, convert and map. Programmable transformations through "transform()", "transform2()" and "matrix_transform()". Filters, sharpen, blur, noise, convolve etc. and filter plugins. Expressions for evaluation engine used by transform2(). Helper class for affine transformations. 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. 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 are listed individually for relevant pod pages. Arnar M. Hrafnkelsson (addi@imager.perl.org) and Tony Cook (tony@imager.perl.org) See the README for a complete list. 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://www.eecs.umich.edu/~addi/perl/Imager/