in reply to Creating .gif images with Perl

ImageMagick can do almost anything you want with images. There may be something more specific for GIFs I haven't used though.

You'd want the base ImageMagick library and the PerlMagick language module.