This directory includes example code for Imager.

If you have sample code to contribute, please contact the maintainer.

The notes here just provide a basic description and the functions

  Produce a color, grey or pure anaglyph image given left and right
  images of a stereoscopic pair.

  Uses transform2() and convert().

  Example using Imager::transform2() to replace one color with another
  in an image.

  Example using Inline::C and the Imager API to replace one color with
  another in an image.

  Produce an interleaved image given the left and right images of a
  stereoscopic pair.  Note that the source images must be pre-scaled.

  This includes 3 different implementations, first using transform2(),
  the second using the internal i_copyto() function and the third using
  the internal i_glin() and i_plin() functions.


  Example that demonstrates generating an image linked from a HTML form.

  The POD for this sample discusses alternate approaches and security


  Example that demonstrates reading an image uploaded via a HTML form.

  Produces an output image scaled to fit inside 200x200.


  Example that demonstrates reading an image uploaded via a HTML form.

  Produces a text/plain report of the tags that Imager defined for the

  This and the previous sample are very similar, the intent is to show
  the common elements and to demonstrate that the output is independent
  of the input.

  See the section "Parsing an image posted via CGI" in Imager::Cookbook
  for cautions and details on reading uploaded images.

  Example of adding a border to an image.

  Example of drawing transformed text.

  Draws slanted or rotated text to a new image and saves it to a file.

  As part of this it demonstrates calculating the transformed bounding
  box of the text.

  Simple example of making a Tk::Photo object using Imager data.

  Simple demonstration of the align_string() method.  Usage:

   perl fontfile size outputfile text...


   perl fontfiles/ImUgly.ttf 60 test.ppm .A.

  This demonstrates how the various values of halign and valign

  Demonstrates using Inline and Imager's API to convert captured BGR
  image data into an Imager image.

  Animate an image fading down to a background color and back again.

  Demonstrates setting an alpha channel with convert(), rubthrough(), 
  and writing animated GIFs.

  Scales an animated GIF image, preserving GIF animation information
  and adjusting the image screen positions to account for the scale

  Sample from Richard Fairhurst demonstrating the use of the transform2()
  det() function.  Transforms an arbitrary quadrilateral in the input into
  a square on the output.

  Produce an animated GIF that blends back and forth between the two
  supplied images.  If the input images form a stereo pair the GIF can
  be used for wiggle stereoscopy.

  Produce a drop shadow based on the source image alpha channel.