in reply to Producing images on the fly.

GD.pm should do the trick.

From the docs:

GD.pm is a port of Thomas Boutell's gd graphics library (see below). GD allows you to create color drawings using a large number of graphics primitives, and emit the drawings as PNG files.

GD defines the following three classes:

GD::Image
An image class, which holds the image data and accepts graphic primitive method calls.

GD::Font
A font class, which holds static font information and used for text rendering.

GD::Polygon
A simple polygon object, used for storing lists of vertices prior to rendering a polygon into an image.

-monkfish (The Fishy Monk)