BSE
  Watcom C/C++
  Perl
  Imager
    Imager::Graph
  ImUgly
  Contact Us
 

Imager

Imager is a perl module for manipulating gray, color and rgba format images. It can read various file formats, has lots of filters, a builtin interpretered language for blends, fades and multi-image effects. It has drawing primitives and supports antialiased truetype and postscript fonts. It also has a plugin interface to write plugins in C.

If you're having trouble using giflib with Imager, you probably want the giflib patch which fixes a couple of bugs in giflib.

Imager samples

I've created some pages that demonstrate various aspects of Imager:

I'm also working on Imager::Graph, though currently it only has pie graphs. At least in theory - I never seem to find the time to work on this, though I have done a little work on bar charts.

In between paying work (which I have enough of :), I'm trying to enhance the way Imager handles text, since it can be a bit confusing sometimes. In particular:

  • try to clean up the inconsistencies between font types:
    • utf8 (even if we just treat characters over 0xFF as missing for T1)
    • transformations (where available)
    • has_char() method
  • easy interfaces for text output:
    • align text around point, including:
      • left, center, right horizontal alignment
      • top, center, baseline, bottom alignment
      • choose whether to base alignment upon character cells or font metrics to avoid spacing problems between lines
    • fill a box from text, with newline handling
      • an option to just return the information that would be used to output the text, so it can be used for sizing calculations
      • how much text fit in the box/how much space is left in the box
    • fill a box with rich text (size and font changes)
      • as above
      • wrapping around boxes/images
    • pod2Imager :)
  • tools to get more information about fonts/characters:
    • name of font "Arial Bold Italic" vs "arialbi.ttf"
    • ABC widths for characters (currently the only way to get the C width for a character is to get the width with a following space and without and then compare)
    • character names

transform2() extensions.

I originally wrote the transform2 function for Imager, and extended the gif support.

Simple example code on how to produce animated gifs with Imager.

Some examples of how various Imager filters look. I may create a more dynamic wrapper at some point.

Right now I'm working on gradient or fountain fill support similar to that provided by tools like the GIMP or Photoshop. I have a basic version going, but I want to add support for most of the GIMPs features, so the caller can load an existing GIMP gradient file.

I'm currently extending the current transform2() function to support more general functions by adding jump operators in the low-level register machine, and adding support to the existing compilers to support loops and conditional statements.

I'm also planning on changing Imager::Expr::Infix to use a pre-compiled grammar, rather than compiling a grammar with Parse::RecDescent the first time it is used. It may be possible to use Parse::Yapp to do this.

To do:

  • add jump operators to regmach.[ch]. Because we need actual variables now, I also added a set operator. (done)
  • created a simple assembler to be able to directly produce register code instructions. (done)
  • port Imager::Expr::Infix to Parse::Yapp
  • modify the grammar and compiler to support loops, etc

Other Imager Tasks

Some other things I'm planning on doing with Imager:

  • UTF-8 on Win32
  • other charsets for FreeType2/Win32
  • access to glyph names and other font information
  • fill a mask (a greyscale mask) with a general fill
  • operations on a mask:
    • bigger, and
    • smaller, by a given size
  • paths and stroking of the paths