=over
-=item C<errstr>
+=item errstr()
Returns the last error message in that context.
Where to find information on methods for Imager class objects.
-addcolors() - L<Imager::ImageTypes/addcolors> - add colors to a
+addcolors() - L<Imager::ImageTypes/addcolors()> - add colors to a
paletted image
-addtag() - L<Imager::ImageTypes/addtag> - add image tags
+addtag() - L<Imager::ImageTypes/addtag()> - add image tags
-align_string() - L<Imager::Draw/align_string> - draw text aligned on a
+align_string() - L<Imager::Draw/align_string()> - draw text aligned on a
point
-arc() - L<Imager::Draw/arc> - draw a filled arc
+arc() - L<Imager::Draw/arc()> - draw a filled arc
-bits() - L<Imager::ImageTypes/bits> - number of bits per sample for the
+bits() - L<Imager::ImageTypes/bits()> - number of bits per sample for the
image
-box() - L<Imager::Draw/box> - draw a filled or outline box.
+box() - L<Imager::Draw/box()> - draw a filled or outline box.
-circle() - L<Imager::Draw/circle> - draw a filled circle
+circle() - L<Imager::Draw/circle()> - draw a filled circle
-colorcount() - L<Imager::Draw/colorcount> - the number of colors in an
-image's palette (paletted images only)
+colorcount() - L<Imager::ImageTypes/colorcount()> - the number of
+colors in an image's palette (paletted images only)
-combine() - L<Imager::Transformations/combine> - combine channels from one or
-more images.
+combine() - L<Imager::Transformations/combine()> - combine channels
+from one or more images.
-combines() - L<Imager::Draw/combines> - return a list of the different
-combine type keywords
+combines() - L<Imager::Draw/combines()> - return a list of the
+different combine type keywords
-compose() - L<Imager::Transformations/compose> - compose one image
+compose() - L<Imager::Transformations/compose()> - compose one image
over another.
convert() - L<Imager::Transformations/"Color transformations"> -
transform the color space
-copy() - L<Imager::Transformations/copy> - make a duplicate of an
+copy() - L<Imager::Transformations/copy()> - make a duplicate of an
image
-crop() - L<Imager::Transformations/crop> - extract part of an image
+crop() - L<Imager::Transformations/crop()> - extract part of an image
-def_guess_type() - L<Imager::Files/def_guess_type> - default function
+def_guess_type() - L<Imager::Files/def_guess_type()> - default function
used to guess the output file format based on the output file name
-deltag() - L<Imager::ImageTypes/deltag> - delete image tags
+deltag() - L<Imager::ImageTypes/deltag()> - delete image tags
difference() - L<Imager::Filters/"Image Difference"> - produce a
difference images from two input images.
-errstr() - L<"Basic Overview"> - the error from the last failed
+errstr() - L</"Basic Overview"> - the error from the last failed
operation.
filter() - L<Imager::Filters> - image filtering
-findcolor() - L<Imager::ImageTypes/findcolor> - search the image
+findcolor() - L<Imager::ImageTypes/findcolor()> - search the image
palette, if it has one
-flip() - L<Imager::Transformations/flip> - flip an image, vertically,
+flip() - L<Imager::Transformations/flip()> - flip an image, vertically,
horizontally
-flood_fill() - L<Imager::Draw/flood_fill> - fill an enclosed or same
+flood_fill() - L<Imager::Draw/flood_fill()> - fill an enclosed or same
color area
-getchannels() - L<Imager::ImageTypes/getchannels> - the number of
+getchannels() - L<Imager::ImageTypes/getchannels()> - the number of
samples per pixel for an image
-getcolorcount() - L<Imager::ImageTypes/getcolorcount> - the number of
+getcolorcount() - L<Imager::ImageTypes/getcolorcount()> - the number of
different colors used by an image (works for direct color images)
-getcolors() - L<Imager::ImageTypes/getcolors> - get colors from the image
+getcolors() - L<Imager::ImageTypes/getcolors()> - get colors from the image
palette, if it has one
-getcolorusage() - L<Imager::ImageTypes/getcolorusage>
+getcolorusage() - L<Imager::ImageTypes/getcolorusage()>
-getcolorusagehash() - L<Imager::ImageTypes/getcolorusagehash>
+getcolorusagehash() - L<Imager::ImageTypes/getcolorusagehash()>
get_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
-getheight() - L<Imager::ImageTypes/getwidth> - height of the image in
+getheight() - L<Imager::ImageTypes/getwidth()> - height of the image in
pixels
-getmask() - L<Imager::ImageTypes/getmask> - write mask for the image
+getmask() - L<Imager::ImageTypes/getmask()> - write mask for the image
-getpixel() - L<Imager::Draw/getpixel> - retrieve one or more pixel
+getpixel() - L<Imager::Draw/getpixel()> - retrieve one or more pixel
colors
-getsamples() - L<Imager::Draw/getsamples> - retrieve samples from a
+getsamples() - L<Imager::Draw/getsamples()> - retrieve samples from a
row or partial row of pixels.
-getscanline() - L<Imager::Draw/getscanline> - retrieve colors for a
+getscanline() - L<Imager::Draw/getscanline()> - retrieve colors for a
row or partial row of pixels.
-getwidth() - L<Imager::ImageTypes/getwidth> - width of the image in
+getwidth() - L<Imager::ImageTypes/getwidth()> - width of the image in
pixels.
-img_set() - L<Imager::ImageTypes/img_set> - re-use an Imager object
+img_set() - L<Imager::ImageTypes/img_set()> - re-use an Imager object
for a new image.
-init() - L<Imager::ImageTypes/init>
+init() - L<Imager::ImageTypes/init()>
-is_bilevel() - L<Imager::ImageTypes/is_bilevel> - returns whether
+is_bilevel() - L<Imager::ImageTypes/is_bilevel()> - returns whether
image write functions should write the image in their bilevel (blank
and white, no gray levels) format
-line() - L<Imager::Draw/line> - draw an interval
+line() - L<Imager::Draw/line()> - draw an interval
-load_plugin() - L<Imager::Filters/load_plugin>
+load_plugin() - L<Imager::Filters/load_plugin()>
map() - L<Imager::Transformations/"Color Mappings"> - remap color
channel values
-masked() - L<Imager::ImageTypes/masked> - make a masked image
+masked() - L<Imager::ImageTypes/masked()> - make a masked image
-matrix_transform() - L<Imager::Engines/matrix_transform>
+matrix_transform() - L<Imager::Engines/matrix_transform()>
-maxcolors() - L<Imager::ImageTypes/maxcolors>
+maxcolors() - L<Imager::ImageTypes/maxcolors()>
-NC() - L<Imager::Handy/NC>
+NC() - L<Imager::Handy/NC()>
-NCF() - L<Imager::Handy/NCF>
+NCF() - L<Imager::Handy/NCF()>
-new() - L<Imager::ImageTypes/new>
+new() - L<Imager::ImageTypes/new()>
-newcolor() - L<Imager::Handy/newcolor>
+newcolor() - L<Imager::Handy/newcolor()>
-newcolour() - L<Imager::Handy/newcolour>
+newcolour() - L<Imager::Handy/newcolour()>
-newfont() - L<Imager::Handy/newfont>
+newfont() - L<Imager::Handy/newfont()>
-NF() - L<Imager::Handy/NF>
+NF() - L<Imager::Handy/NF()>
open() - L<Imager::Files> - an alias for read()
=for stopwords IPTC
-parseiptc() - L<Imager::Files/parseiptc> - parse IPTC data from a JPEG
+parseiptc() - L<Imager::Files/parseiptc()> - parse IPTC data from a JPEG
image
-paste() - L<Imager::Transformations/paste> - draw an image onto an image
+paste() - L<Imager::Transformations/paste()> - draw an image onto an
+image
-polygon() - L<Imager::Draw/polygon>
+polygon() - L<Imager::Draw/polygon()>
-polyline() - L<Imager::Draw/polyline>
+polyline() - L<Imager::Draw/polyline()>
-preload() - L<Imager::Files/preload>
+preload() - L<Imager::Files/preload()>
read() - L<Imager::Files> - read a single image from an image file
read_multi() - L<Imager::Files> - read multiple images from an image
file
-read_types() - L<Imager::Files/read_types> - list image types Imager
+read_types() - L<Imager::Files/read_types()> - list image types Imager
can read.
-register_filter() - L<Imager::Filters/register_filter>
+register_filter() - L<Imager::Filters/register_filter()>
-register_reader() - L<Imager::Files/register_reader>
+register_reader() - L<Imager::Files/register_reader()>
-register_writer() - L<Imager::Files/register_writer>
+register_writer() - L<Imager::Files/register_writer()>
-rotate() - L<Imager::Transformations/rotate>
+rotate() - L<Imager::Transformations/rotate()>
-rubthrough() - L<Imager::Transformations/rubthrough> - draw an image onto an
-image and use the alpha channel
+rubthrough() - L<Imager::Transformations/rubthrough()> - draw an image
+onto an image and use the alpha channel
-scale() - L<Imager::Transformations/scale>
+scale() - L<Imager::Transformations/scale()>
-scale_calculate() - L<Imager::Transformations/scale_calculate>
+scale_calculate() - L<Imager::Transformations/scale_calculate()>
-scaleX() - L<Imager::Transformations/scaleX>
+scaleX() - L<Imager::Transformations/scaleX()>
-scaleY() - L<Imager::Transformations/scaleY>
+scaleY() - L<Imager::Transformations/scaleY()>
-setcolors() - L<Imager::ImageTypes/setcolors> - set palette colors in
-a paletted image
+setcolors() - L<Imager::ImageTypes/setcolors()> - set palette colors
+in a paletted image
set_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
-setmask() - L<Imager::ImageTypes/setmask>
+setmask() - L<Imager::ImageTypes/setmask()>
-setpixel() - L<Imager::Draw/setpixel>
+setpixel() - L<Imager::Draw/setpixel()>
-setsamples() - L<Imager::Draw/setsamples>
+setsamples() - L<Imager::Draw/setsamples()>
-setscanline() - L<Imager::Draw/setscanline>
+setscanline() - L<Imager::Draw/setscanline()>
-settag() - L<Imager::ImageTypes/settag>
+settag() - L<Imager::ImageTypes/settag()>
-string() - L<Imager::Draw/string> - draw text on an image
+string() - L<Imager::Draw/string()> - draw text on an image
-tags() - L<Imager::ImageTypes/tags> - fetch image tags
+tags() - L<Imager::ImageTypes/tags()> - fetch image tags
-to_paletted() - L<Imager::ImageTypes/to_paletted>
+to_paletted() - L<Imager::ImageTypes/to_paletted()>
-to_rgb16() - L<Imager::ImageTypes/to_rgb16>
+to_rgb16() - L<Imager::ImageTypes/to_rgb16()>
-to_rgb8() - L<Imager::ImageTypes/to_rgb8>
+to_rgb8() - L<Imager::ImageTypes/to_rgb8()>
-transform() - L<Imager::Engines/"transform">
+transform() - L<Imager::Engines/"transform()">
-transform2() - L<Imager::Engines/"transform2">
+transform2() - L<Imager::Engines/"transform2()">
-type() - L<Imager::ImageTypes/type> - type of image (direct vs paletted)
+type() - L<Imager::ImageTypes/type()> - type of image (direct vs paletted)
-unload_plugin() - L<Imager::Filters/unload_plugin>
+unload_plugin() - L<Imager::Filters/unload_plugin()>
-virtual() - L<Imager::ImageTypes/virtual> - whether the image has it's own
+virtual() - L<Imager::ImageTypes/virtual()> - whether the image has it's own
data
write() - L<Imager::Files> - write an image to a file
write_multi() - L<Imager::Files> - write multiple image to an image
file.
-write_types() - L<Imager::Files/read_types> - list image types Imager
+write_types() - L<Imager::Files/read_types()> - list image types Imager
can write.
=head1 CONCEPT INDEX
animated GIF - L<Imager::Files/"Writing an animated GIF">
-aspect ratio - L<Imager::ImageTypes/i_xres>,
-L<Imager::ImageTypes/i_yres>, L<Imager::ImageTypes/i_aspect_only>
+aspect ratio - C<i_xres>, C<i_yres>, C<i_aspect_only> in
+L<Imager::ImageTypes/"Common Tags">.
blend - alpha blending one image onto another
-L<Imager::Transformations/rubthrough>
+L<Imager::Transformations/rubthrough()>
-blur - L<Imager::Filters/guassian>, L<Imager::Filters/conv>
+blur - L<Imager::Filters/gaussian>, L<Imager::Filters/conv>
-boxes, drawing - L<Imager::Draw/box>
+boxes, drawing - L<Imager::Draw/box()>
changes between image - L<Imager::Filters/"Image Difference">
-channels, combine into one image - L<Imager::Transformations/combine>
+channels, combine into one image - L<Imager::Transformations/combine()>
color - L<Imager::Color>
convolution - L<Imager::Filters/conv>
-cropping - L<Imager::Transformations/crop>
+cropping - L<Imager::Transformations/crop()>
CUR files - L<Imager::Files/"ICO (Microsoft Windows Icon) and CUR (Microsoft Windows Cursor)">
C<diff> images - L<Imager::Filters/"Image Difference">
-dpi - L<Imager::ImageTypes/i_xres>,
+dpi - C<i_xres>, C<i_yres> in L<Imager::ImageTypes/"Common Tags">,
L<Imager::Cookbook/"Image spatial resolution">
-drawing boxes - L<Imager::Draw/box>
+drawing boxes - L<Imager::Draw/box()>
-drawing lines - L<Imager::Draw/line>
+drawing lines - L<Imager::Draw/line()>
-drawing text - L<Imager::Draw/string>, L<Imager::Draw/align_string>
+drawing text - L<Imager::Draw/string()>, L<Imager::Draw/align_string()>
-error message - L<"ERROR HANDLING">
+error message - L</"ERROR HANDLING">
files, font - L<Imager::Font>
filling, types of fill - L<Imager::Fill>
-filling, boxes - L<Imager::Draw/box>
+filling, boxes - L<Imager::Draw/box()>
-filling, flood fill - L<Imager::Draw/flood_fill>
+filling, flood fill - L<Imager::Draw/flood_fill()>
-flood fill - L<Imager::Draw/flood_fill>
+flood fill - L<Imager::Draw/flood_fill()>
fonts - L<Imager::Font>
-fonts, drawing with - L<Imager::Draw/string>,
-L<Imager::Draw/align_string>, L<Imager::Font::Wrap>
+fonts, drawing with - L<Imager::Draw/string()>,
+L<Imager::Draw/align_string()>, L<Imager::Font::Wrap>
-fonts, metrics - L<Imager::Font/bounding_box>, L<Imager::Font::BBox>
+fonts, metrics - L<Imager::Font/bounding_box()>, L<Imager::Font::BBox>
fonts, multiple master - L<Imager::Font/"MULTIPLE MASTER FONTS">
GIF files - L<Imager::Files/"GIF">
-GIF files, animated - L<Imager::File/"Writing an animated GIF">
+GIF files, animated - L<Imager::Files/"Writing an animated GIF">
gradient fill - L<Imager::Fill/"Fountain fills">,
L<Imager::Filters/fountain>, L<Imager::Fountain>,
L<Imager::Filters/gradgen>
-gray scale, convert image to - L<Imager::Transformations/convert>
+gray scale, convert image to - L<Imager::Transformations/convert()>
-guassian blur - L<Imager::Filters/guassian>
+gaussian blur - L<Imager::Filters/gaussian>
hatch fills - L<Imager::Fill/"Hatched fills">
limiting image sizes - L<Imager::Files/"Limiting the sizes of images you read">
-lines, drawing - L<Imager::Draw/line>
+lines, drawing - L<Imager::Draw/line()>
matrix - L<Imager::Matrix2d>,
-L<Imager::Transformations/"Matrix Transformations">,
-L<Imager::Font/transform>
+L<Imager::Engines/"Matrix Transformations">,
+L<Imager::Font/transform()>
metadata, image - L<Imager::ImageTypes/"Tags">
noise, rendered - L<Imager::Filters/turbnoise>,
L<Imager::Filters/radnoise>
-paste - L<Imager::Transformations/paste>,
-L<Imager::Transformations/rubthrough>
+paste - L<Imager::Transformations/paste()>,
+L<Imager::Transformations/rubthrough()>
-pseudo-color image - L<Imager::ImageTypes/to_paletted>,
-L<Imager::ImageTypes/new>
+pseudo-color image - L<Imager::ImageTypes/to_paletted()>,
+L<Imager::ImageTypes/new()>
=for stopwords posterize
PNM - L<Imager::Files/"PNM (Portable aNy Map)">
-rectangles, drawing - L<Imager::Draw/box>
+rectangles, drawing - L<Imager::Draw/box()>
-resizing an image - L<Imager::Transformations/scale>,
-L<Imager::Transformations/crop>
+resizing an image - L<Imager::Transformations/scale()>,
+L<Imager::Transformations/crop()>
RGB (SGI) files - L<Imager::Files/"SGI (RGB, BW)">
saving an image - L<Imager::Files>
-scaling - L<Imager::Transformations/scale>
+scaling - L<Imager::Transformations/scale()>
SGI files - L<Imager::Files/"SGI (RGB, BW)">
sharpen - L<Imager::Filters/unsharpmask>, L<Imager::Filters/conv>
-size, image - L<Imager::ImageTypes/getwidth>,
-L<Imager::ImageTypes/getheight>
+size, image - L<Imager::ImageTypes/getwidth()>,
+L<Imager::ImageTypes/getheight()>
-size, text - L<Imager::Font/bounding_box>
+size, text - L<Imager::Font/bounding_box()>
tags, image metadata - L<Imager::ImageTypes/"Tags">
-text, drawing - L<Imager::Draw/string>, L<Imager::Draw/align_string>,
+text, drawing - L<Imager::Draw/string()>, L<Imager::Draw/align_string()>,
L<Imager::Font::Wrap>
text, wrapping text in an area - L<Imager::Font::Wrap>
-text, measuring - L<Imager::Font/bounding_box>, L<Imager::Font::BBox>
+text, measuring - L<Imager::Font/bounding_box()>, L<Imager::Font::BBox>
tiles, color - L<Imager::Filters/mosaic>
=over
-=item line
+=item line()
$img->line(color=>$green, x1=>10, x2=>100,
y1=>20, y2=>50, aa=>1, endp=>1 );
=item *
-C<color> - the color of the line. See L<"Color Parameters">. Default:
+C<color> - the color of the line. See L</"Color Parameters">. Default:
black.
=item *
=back
-=item polyline(points => [ [ x, y ], [ x, y ], ... ], color => color)
+=item polyline()
$img->polyline(points=>[[$x0,$y0],[$x1,$y1],[$x2,$y2]],color=>$red);
$img->polyline(x=>[$x0,$x1,$x2], y=>[$y0,$y1,$y2], aa=>1);
=item *
-C<color> - the color of the line. See L<"Color Parameters">.
+C<color> - the color of the line. See L</"Color Parameters">.
Default: black.
=item *
=back
-=item box
+=item box()
$blue = Imager::Color->new( 0, 0, 255 );
$img->box(color => $blue, xmin=>10, ymin=>30, xmax=>200, ymax=>300,
=item *
-C<color> - the color of the line. See L<"Color Parameters">.
+C<color> - the color of the line. See L</"Color Parameters">.
Default: white. This is ignored if the filled parameter
=item *
=item *
C<fill> - the fill for the box. If this is supplied then the box will be
-filled. See L<"Fill Parameters">.
+filled. See L</"Fill Parameters">.
=back
-=item arc
+=item arc()
$img->arc(color=>$red, r=>20, x=>200, y=>100, d1=>10, d2=>20 );
=item *
-C<color> - the color of the filled arc. See L<"Color Parameters">.
+C<color> - the color of the filled arc. See L</"Color Parameters">.
Default: white. Overridden by C<fill>.
=item *
-C<fill> - the fill for the filled arc. See L<"Fill Parameters">
+C<fill> - the fill for the filled arc. See L</"Fill Parameters">
=item *
$img->arc(x => 100, y => 150, r => 90, filled => 0,
color => '#0f0', aa => 1, d1 => 90, d2 => 180);
-=item circle
+=item circle()
$img->circle(color=>$green, r=>50, x=>200, y=>100, aa=>1, filled=>1);
=item *
-C<color> - the color of the filled circle. See L<"Color Parameters">.
+C<color> - the color of the filled circle. See L</"Color Parameters">.
Default: white. Overridden by C<fill>.
=item *
-C<fill> - the fill for the filled circle. See L<"Fill Parameters">
+C<fill> - the fill for the filled circle. See L</"Fill Parameters">
=item *
=item *
-C<color> - the color of the filled polygon. See L<"Color Parameters">.
+C<color> - the color of the filled polygon. See L</"Color Parameters">.
Default: black. Overridden by C<fill>.
=item *
-C<fill> - the fill for the filled circle. See L<"Fill Parameters">
+C<fill> - the fill for the filled circle. See L</"Fill Parameters">
=back
=item *
-C<color> - the color of the filled area. See L<"Color Parameters">.
+C<color> - the color of the filled area. See L</"Color Parameters">.
Default: white. Overridden by C<fill>.
=item *
-C<fill> - the fill for the filled area. See L<"Fill Parameters">
+C<fill> - the fill for the filled area. See L</"Fill Parameters">
=item *
C<border> - the border color of the region to be filled. If this
parameter is supplied flood_fill() will stop when it finds this color.
If this is not supplied then a normal fill is done. C<border> can be
-supplied as a L<"Color Parameter">.
+supplied as a L</"Color Parameters">.
=back
=item *
-color - the color of the pixels drawn. See L<"Color Parameters">.
+color - the color of the pixels drawn. See L</"Color Parameters">.
Default: white.
=back
=back
-=item string
+=item string()
my $font = Imager::Font->new(file=>"foo.ttf");
$img->string(x => 50, y => 70,
C<utf8> - for drivers that support it, treat the string as UTF-8
encoded. For versions of perl that support Unicode (5.6 and later),
this will be enabled automatically if the C<string> parameter is
-already a UTF-8 string. See L<Imager::Font/"UTF8"> for more
+already a UTF-8 string. See L<Imager::Font/"UTF-8"> for more
information.
=item *
On error, string() returns false and you can use $img->errstr to get
the reason for the error.
-=item align_string
+=item align_string()
Draws text aligned around a point on the image.
=item setscanline()
Set all or part of a horizontal line of pixels to an image. This
-method is most useful in conjunction with L</getscanline>.
+method is most useful in conjunction with L</getscanline()>.
The parameters you can pass are:
=item getscanline()
Read all or part of a horizontal line of pixels from an image. This
-method is most useful in conjunction with L</setscanline>.
+method is most useful in conjunction with L</setscanline()>.
The parameters you can pass are:
}
}
-Some of the examples for L</setscanline> for more examples.
+Some of the examples for L</setscanline()> for more examples.
=item getsamples()
For details on expression parsing see L<Imager::Expr>. For details on
the virtual machine used to transform the images, see
-L<Imager::regmach.pod>.
+L<Imager::regmach>.
# generate a colorful spiral
# requires that Parse::RecDescent be installed
=over
-=item matrix_transform
+=item matrix_transform()
Rather than having to write code in a little language, you can use a
matrix to perform affine transformations, using the matrix_transform()
print join " ", keys %Imager::formats;
This will include some other information identifying libraries rather
-than file formats. For new code you might find the L</read_types> or
-L</write_types> methods useful.
+than file formats. For new code you might find the L</read_types()>
+or L</write_types()> methods useful.
=over
Imager->write_multi({ file=> $filename, type=>$type }, @images)
or die "Cannot write $filename: ", Imager->errstr;
-=item read_types
+=item read_types()
This is a class method that returns a list of the image file types
that Imager can read.
attempting to read a file, which may modify the list of available read
types.
-=item write_types
+=item write_types()
This is a class method that returns a list of the image file types
that Imager can write.
=over
-=item def_guess_type
+=item def_guess_type()
This is the default function Imager uses to derive a file type from a
file name. This is a function, not a method.
=back
-=head2 GIF (Graphics Interchange Format)
+=head2 GIF
When writing one of more GIF images you can use the same
L<Quantization Options|Imager::ImageTypes> as you can when converting
gif_trans_color - A reference to an Imager::Color object, which is the
color to use for the palette entry used to represent transparency in
-the palette. You need to set the C<transp> option (see L<Quantization
-options>) for this value to be used.
+the palette. You need to set the C<transp> option (see
+L<Imager::ImageTypes/"Quantization options">) for this value to be
+used.
=item *
=over
-=item register_reader
+=item register_reader()
Registers single or multiple image read functions.
},
);
-=item register_writer
+=item register_writer()
Registers single or multiple image write functions.
=over
-=item preload
+=item preload()
This preloads the file support modules included with or that have been
included with Imager in the past. This is intended for use in forking
Every one of these filters modifies the image in place.
If none of the filters here do what you need, the
-L<Imager::Engines/tranform> or L<Imager::Engines/transform2> function
-may be useful.
+L<Imager::Engines/transform()> or L<Imager::Engines/transform2()>
+function may be useful.
+
+=for stopwords
+autolevels bumpmap bumpmap_complex conv gaussian hardinvert hardinvertall
+radnoise turbnoise unsharpmask gradgen postlevels
A reference of the filters follows:
=over
-=item C<autolevels>
+=item autolevels
scales the value of each channel so that the values in the image will
cover the whole possible range for the channel. C<lsat> and C<usat>
$img->filter(type=>"autolevels", lsat=>0.2, usat=>0.2)
or die $img->errstr;
-=item C<bumpmap>
+=item bumpmap
uses the channel C<elevation> image C<bump> as a bump map on your
image, with the light at (C<lightx>, C<lightty>), with a shadow length
lightx=>10, lighty=>10, st=>5)
or die $img->errstr;
-=item C<bumpmap_complex>
+=item bumpmap_complex
uses the channel C<channel> image C<bump> as a bump map on your image.
If C<< Lz < 0 >> the three L parameters are considered to be the
$img->filter(type=>"bumpmap_complex", bump=>$bumpmap_img)
or die $img->errstr;
-=item C<contrast>
+=item contrast
scales each channel by C<intensity>. Values of C<intensity> < 1.0
will reduce the contrast.
$img->filter(type=>"contrast", intensity=>0.8)
or die $img->errstr;
-=item C<conv>
+=item conv
performs 2 1-dimensional convolutions on the image using the values
from C<coef>. C<coef> should be have an odd length and the sum of the
$img->filter(type=>"conv", coef=>[ -0.5, 1, -0.5 ])
or die $img->errstr;
-=item C<fountain>
+=item fountain
renders a fountain fill, similar to the gradient tool in most paint
software. The default fill is a linear fill from opaque black to
=for stopwords Gaussian
-=item C<gaussian>
+=item gaussian
performs a Gaussian blur of the image, using C<stddev> as the standard
deviation of the curve used to combine pixels, larger values give
$img->filter(type=>"gaussian", stddev=>5)
or die $img->errstr;
-=item C<gradgen>
+=item gradgen
renders a gradient, with the given I<colors> at the corresponding
points (x,y) in C<xo> and C<yo>. You can specify the way distance is
yo=>[ 10, 50, 50 ],
colors=>[ qw(red blue green) ]);
-=item C<hardinvert>
+=item hardinvert
X<filters, hardinvert>X<hardinvert>
inverts the image, black to white, white to black. All color channels
$img->filter(type=>"hardinvert")
or die $img->errstr;
-=item C<hardinvertall>
+=item hardinvertall
X<filters, hardinvertall>X<hardinvertall>
inverts the image, black to white, white to black. All channels are
$img->filter(type=>"hardinvertall")
or die $img->errstr;
-=item C<mosaic>
+=item mosaic
produces averaged tiles of the given C<size>.
$img->filter(type=>"mosaic", size=>5)
or die $img->errstr;
-=item C<noise>
+=item noise
adds noise of the given C<amount> to the image. If C<subtype> is
zero, the noise is even to each channel, otherwise noise is added to
=for stopwords Perlin
-=item C<radnoise>
+=item radnoise
renders radiant Perlin turbulent noise. The center of the noise is at
(C<xo>, C<yo>), C<ascale> controls the angular scale of the noise ,
ascale=>1, rscale=>0.02)
or die $img->errstr;
-=item C<postlevels>
+=item postlevels
alters the image to have only C<levels> distinct level in each
channel.
$img->filter(type=>"postlevels", levels=>10)
or die $img->errstr;
-=item C<turbnoise>
+=item turbnoise
renders Perlin turbulent noise. (C<xo>, C<yo>) controls the origin of
the noise, and C<scale> the scale of the noise, with lower numbers
=for stopwords unsharp
-=item C<unsharpmask>
+=item unsharpmask
performs an unsharp mask on the image. This increases the contrast of
edges in the image.
=back
-=item C<watermark>
+=item watermark
applies C<wmark> as a watermark on the image with strength C<pixdiff>,
with an origin at (C<tx>, C<ty>)
=over
-=item register_filter
+=item register_filter()
Registers a filter so it is visible via Imager's filter() method.
=head2 Plug-ins
The plug in interface is deprecated. Please use the Imager API, see
-L<Imager::API> and L<External Filters> for details
+L<Imager::API> and L</External Filters> for details
It is possible to add filters to the module without recompiling Imager
itself. This is done by using DSOs (Dynamic shared object) available
=over
-=item load_plugin
+=item load_plugin()
This is a function, not a method, exported by default. You should
import this function explicitly for future compatibility if you need
Returns true on success. Check Imager->errstr on failure.
-=item unload_plugin
+=item unload_plugin()
This is a function, not a method, which is exported by default. You
should import this function explicitly for future compatibility if you
=back
-
-
-=item bounding_box
+=item bounding_box()
Returns the bounding box for the specified string. Example:
C<utf8> - For drivers that support it, treat the string as UTF-8 encoded.
For versions of perl that support Unicode (5.6 and later), this will
be enabled automatically if the 'string' parameter is already a UTF-8
-string. See L<UTF-8> for more information. Default: the C<utf8> value
+string. See L</UTF-8> for more information. Default: the C<utf8> value
passed to Imager::Font->new(...) or 0.
=item *
=item string()
The $img->string(...) method is now documented in
-L<Imager::Draw/string>
+L<Imager::Draw/string()>
=item align(string=>$text,size=>$size,x=>...,y=>...,valign => ...,halign=>...)
Returns a list containing the previous C<xdpi>, C<ydpi> values.
-=item transform(matrix=>$matrix)
+=item transform()
+
+ $font->transform(matrix=>$matrix);
Applies a transformation to the font, where matrix is an array ref of
numbers representing a 2 x 3 matrix:
C<utf8> - For drivers that support it, treat the string as UTF-8
encoded. For versions of perl that support Unicode (5.6 and later),
this will be enabled automatically if the 'string' parameter is
-already a UTF-8 string. See L<UTF-8> for more information. Default:
+already a UTF-8 string. See L</UTF-8> for more information. Default:
the C<utf8> value passed to Imager::Font->new(...) or 0.
=back
=item draw
This is used by Imager's string() method to implement drawing text.
-See L<Imager::Draw/string>.
+See L<Imager::Draw/string()>.
=back
=item NCF()
-Create a new L<Imager::Color::Font> object, supplying any parameters
+Create a new L<Imager::Color::Float> object, supplying any parameters
to the new() method.
my $colorf = NCF(1.0, 0, 0);
=over
-=item new
+=item new()
$img = Imager->new();
$img->read(file=>"alligator.ppm") or die $img->errstr;
print "Image height: ", $img->getheight(), "\n";
-Same details apply as for L<getwidth>.
+Same details apply as for L</getwidth()>.
=item getchannels()
$img->setmask(mask=>$mask); # restore previous mask
C<setmask()> is used to set the channel mask of the image. See
-L<getmask> for details.
+L</getmask()> for details.
=back
=over
-=item to_paletted
+=item to_paletted()
You can create a new paletted image from an existing image using the
to_paletted() method:
$palimg = $img->to_paletted(\%opts)
-where %opts contains the options specified under L<Quantization options>.
+where %opts contains the options specified under L</Quantization options>.
# convert to a paletted image using the web palette
# use the closest color to each pixel
No parameters.
-=item masked
+=item masked()
Creates a masked image. A masked image lets you create an image proxy
object that protects parts of the underlying target image.
=head2 Quantization options
These options can be specified when calling
-L<Imager::ImageTypes/to_paletted>, write_multi() for GIF files, when
+L<Imager::ImageTypes/to_paletted()>, write_multi() for GIF files, when
writing a single image with the C<gifquant> option set to C<gen>, or for
direct calls to i_writegif_gen() and i_writegif_callback().
=over
-=item copy
+=item copy()
To create a copy of an image use the C<copy()> method. This is useful
if you want to keep an original after doing something that changes the image.
$newimg = $orig->copy();
-=item scale
+=item scale()
X<scale>To scale an image so proportions are maintained use the
C<$img-E<gt>scale()> method. if you give either a C<xpixels> or
=over
-=item paste
+=item paste()
X<paste>To copy an image to onto another image use the C<paste()>
method.
compose() returns true on success. On failure check $target->errstr
for the reason for failure.
-=item flip
+=item flip()
An inplace horizontal or vertical flip is possible by calling the
C<flip()> method. If the original is to be preserved it's possible to
=over
-=item convert
+=item convert()
You can use the convert method to transform the color space of an
image using a matrix. For ease of use some presets are provided.
[ 0, 0, 0, 0.5 ],
]);
-=item combine
+=item combine()
X<combine>
Combine channels from one or more input images into a new image.
=over
-=item map
+=item map()
You can use the map method to map the values of each channel of an
image independently using a list of look-up tables. It's important to
const
dpi
eg
-guassian
+gaussian
ie
infix
metadata
--- /dev/null
+#!perl -w
+use strict;
+use Test::More;
+use Pod::Parser;
+use File::Find;
+use File::Spec::Functions qw(rel2abs abs2rel splitdir);
+
+# external stuff we refer to
+my @known =
+ qw(perl Affix::Infix2Postfix Parse::RecDescent GD Image::Magick Graphics::Magick CGI Image::ExifTool XSLoader DynaLoader);
+
+my @pod; # files with pod
+
+my $base = rel2abs("blib/lib");
+
+my @files;
+find(sub {
+ -f && /\.(pod|pm)$/
+ and push @files, $File::Find::name;
+ }, $base);
+
+my %targets = map { $_ => {} } @known;
+my %item_in;
+
+for my $file (@files) {
+ my $parser = PodPreparse->new;
+
+ my $link = abs2rel($file, $base);
+ $link =~ s/\.(pod|pm|pl|PL)$//;
+ $link = join("::", splitdir($link));
+
+ $parser->{'targets'} = \%targets;
+ $parser->{'link'} = $link;
+ $parser->{'file'} = $file;
+ $parser->{item_in} = \%item_in;
+ $parser->parse_from_file($file);
+ if ($targets{$link}) {
+ push @pod, $file;
+ }
+}
+
+plan tests => scalar(@pod);
+
+for my $file (@pod) {
+ my $parser = PodLinkCheck->new;
+ $parser->{"targets"} = \%targets;
+ my $relfile = abs2rel($file, $base);
+ (my $link = $relfile) =~ s/\.(pod|pm|pl|PL)$//;
+ $link = join("::", splitdir($link));
+ $parser->{"file"} = $relfile;
+ $parser->{"link"} = $link;
+ my @errors;
+ $parser->{"errors"} = \@errors;
+ $parser->{item_in} = \%item_in;
+ $parser->parse_from_file($file);
+
+ unless (ok(!@errors, "check links in $relfile")) {
+ print "# $_\n" for @errors;
+ }
+}
+
+package PodPreparse;
+BEGIN { our @ISA = qw(Pod::Parser); }
+
+sub command {
+ my ($self, $cmd, $para) = @_;
+
+ my $targets = $self->{"targets"};
+ my $link = $self->{"link"};
+ $targets->{$link} ||= {};
+
+ if ($cmd =~ /^(head[1-5]|item)/) {
+ $para =~ s/X<.*?>//g;
+ $para =~ s/\s+$//;
+ $targets->{$link}{$para} = 1;
+ push @{$self->{item_in}{$para}}, $link;
+ }
+}
+
+sub verbatim {}
+
+sub textblock {}
+
+package PodLinkCheck;
+BEGIN { our @ISA = qw(Pod::Parser); }
+
+sub command {}
+
+sub verbatim {}
+
+sub textblock {
+ my ($self, $para, $line_num) = @_;
+
+ $self->parse_text
+ (
+ { -expand_seq => "sequence" },
+ $para, $line_num,
+ );
+}
+
+sub sequence {
+ my ($self, $seq) = @_;
+
+ if ($seq->cmd_name eq "L") {
+ my $raw = $seq->raw_text;
+ my $base_link = $seq->parse_tree->raw_text;
+ $base_link =~ /^(https?|ftp|mailto):/
+ and return '';
+ (my $link = $base_link) =~ s/.*\|//;
+ my ($pod, $part) = split m(/), $link, 2;
+ $pod ||= $self->{link};
+ if ($part) {
+ $part =~ s/^\"//;
+ $part =~ s/"$//;
+ }
+ my $targets = $self->{targets};
+ my $errors = $self->{errors};
+ (undef, my $line) = $seq->file_line;
+
+ if (!$targets->{$pod}) {
+ push @$errors, "$line: No $pod found ($raw)";
+ }
+ elsif ($part && !$targets{$pod}{$part}) {
+ push @$errors, "$line: No item/section '$part' found in $pod ($raw)";
+ if ($self->{item_in}{$part}) {
+ push @$errors, " $part can be found in:";
+ push @$errors, map " $_", @{$self->{item_in}{$part}};
+ }
+ }
+ }
+
+ return $seq->raw_text;
+}
+