cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
  I'm writing some graphics routines that I want to make as universal as possible depending on the machine it's installed upon. In a previous post people pointed me to GD. In some searches on CPAN and google I found out about ImageMagik. I'm curious as to whether there is yet another graphics program that can be used to create images?

I'll be writing my own image module that'll basically check to see if GD or ImageMagik are installed, load the relevant modules and create the required image.

Do you think there would be an interest for this module in CPAN?

Lastly I am dabbling with ASP/PerlScript from ActiveState. My new scripts can run with the extenstions .pl, .cgi or .asp without the need to update code. I was wondering if anyone knows of any image routines that are on Win32 systems by default and can be access when running ASP/PerlScript?

Thanks again!

Replies are listed 'Best First'.
Re: GD, ImageMagik, are there others?
by davidrw (Prior) on Sep 05, 2005 at 15:40 UTC

      Whaaaaahoooo!

      I'd never heard of Imager and this module changes my life. All I have wanted to do is take client uploaded images, of any sort, and size them to jpeg thumbnails and full size for an online gallery. GD has lousy quality and ImageMagik is just too scary. Anyway, I had Imager working like a charm in minutes.

      #!/usr/bin/perl print "Content-type: text/html\n\n"; use Imager; use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); my $img = Imager->new(); $img->read(file=>"../Uploaded_image.tif") or die $img->errstr; my $imgfull = Imager->new(); my $imgfull = $img->scale(xpixels => 500); # 400x285 $imgfull->write(file=>"../Uploaded_image.jpg", type=>"jpeg") or die "Cannot write: ", $imgfull->errstr; my $imgthum = Imager->new(); my $imgthum = $img->scale(xpixels => 100); # 400x285 $imgthum->write(file=>"../Uploaded_image_thumb.jpg", type=>"jpeg") or die "Cannot write: ", $imgthum->errstr;

      Thanks!


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re: GD, ImageMagik, are there others?
by zentara (Cardinal) on Sep 05, 2005 at 17:28 UTC
    I usually use Imager as my first choice. Why? It's install is self-contained. With GD and ImageMagick, you have to install the c-libs first, and especially with GD, people are always running into compatibility problems between their Perl-GD module and the version of their GD-c-libs. Also, Imager has good perldocs. If you want to see an example of Imager, check out Mirrored text with Imager

    I'm not really a human, but I play one on earth. flash japh
Re: GD, ImageMagik, are there others?
by Anonymous Monk on Sep 05, 2005 at 23:04 UTC