Posted on 2005-02-10 17:12:52-08 by wbeaver
Need help with GD install problems

I have a problem in which test scripts which use GD.pm generate GIFs just fine, but not PNGs.

- Latest CPAN module was installed and appeared to make, etc., properly

rpm -qi for gd-related linux packages returned the following:

gd 1.8.4
gd 2.0.20
zlib 1.1.4
libpng 1.2.2
libpng 1.2.2

All have been recompiled, etc., and re-ran the download/install from CPAN following their "making", etc.

Yet, the following simple script returns "No such file or directory" when "gif" is replaced by "png" in the final line. I therefore trust that GD.pm is not the culprit (since teh gif output works fine), but I'm still asking here since I'd imagine someone else had problems with the supporting packages. I'm testing via command line, not web browser (first things first...) Server is running Redhat 8.

#!/usr/bin/perl #use strict; #use warnings; use GD; # create a new image $im = new GD::Image(100,100); # allocate some colors $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); $red = $im->colorAllocate(255,0,0); $blue = $im->colorAllocate(0,0,255); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,99,99,$black); # Draw a blue oval $im->arc(50,50,95,75,0,360,$blue); # And fill it with red $im->fill(50,50,$red); # make sure we are writing to a binary stream binmode STDOUT; # Convert the image to PNG and print it on standard output print $im->gif;
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.