I finally got the script to work!! Thanks for all your help and suggestions. http://shawn.apocabilly.org/PGP/examples/example2-1.txt
I had to add the line: binmode STDOUT; right before the last line: print $image->png; A friend of mine was able to get it to work without adding that line. Is there some setting that I didn't set or is this normal for a default install of perl on RH 8? Thanks again, Joel -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 1:59 PM To: Joel Lopez; [EMAIL PROTECTED] Subject: RE: trying out examples in Oreilly's Perl Graphics Programming Please don't top post... ------------------------------------------------ On Wed, 16 Jul 2003 13:11:57 -0700, "Joel Lopez" <[EMAIL PROTECTED]> wrote: > Hi, > > using this seems to get rid of the garbled stuff: > ./helloworld2 > output.png > > Is output.png supposed to be an existing image or is it one that is created > on the fly? > It is created on the fly. > The code refers to the book authors home directory: > > my ($x1, $y1, $x2, $y2, > $x3, $y3, $x4, $y4) = $image->stringFT($black, > "/home/shawn/arial.ttf", 48, 0, 40, 120, "Hello World"); > arial.ttf is the font that will be used for the words "Hello World" probably you need to replace that location with the path to a similar (Truetype) font on your local computer. > Is this where the image is read from or created to? The book site doesn't > give an image to work with. > Neither. The image is essentially just a set of properties stored in a Perl object. Then when you have finished manipulating the object you call the 'png' method on the object to magically transform your Perl object into image data (a PNG) that can then be used in some way, specifically in the example it is printed to STDOUT. That is why I had you redirect the output into a file, namely output.png which is your newly generated image. If it were a CGI for example, you would want to print the proper MIME header, and then just print the data to STDOUT, but from a terminal window that is not terribly helpful. > thanks for helping a lost man, You will get there, somewhat complicated at first but once the samples make sense it is pretty much boundless what you can accomplish. http://danconia.org > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 16, 2003 12:22 PM > To: Joel Lopez; [EMAIL PROTECTED] > Subject: RE: trying out examples in Oreilly's Perl Graphics Programming > > > > ------------------------------------------------ > On 16 Jul 2003 11:28:31 -0700, Joel Lopez <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > > I have been trying to get this perl script to work, but I'm can't seem > > to figure out why it's not working. You can see it here: > > > > http://shawn.apocabilly.org/PGP/examples/example2-1.txt > > > > When I run it I get this on my screen: > > > > [EMAIL PROTECTED] imagemagick]# ./helloworld2 > > Use of uninitialized value in subtraction (-) at ./helloworld2 line 31. > > Use of uninitialized value in addition (+) at ./helloworld2 line 31. > > Use of uninitialized value in addition (+) at ./helloworld2 line 31. > > Use of uninitialized value in subtraction (-) at ./helloworld2 line 31. > > PNG > > <snip image data> > > > > > I first typed it in, but then after I couldn't get it to work I copied > > and pasted it into a file. > > > > I'm using Red Hat 8 and have updated the libgd C library to version > > 1.8.4 and then used cpan to install GD. > > > > I ran the demo for libgd and it made the graphic it was supposed to so I > > think it's working ok. Is there anyway to find out if everything is > > installed correctly? > > > > What makes you think it didn't work correctly? The script just prints the > image data to the screen, which is basically what that garbled mess was in > your e-mail. Try opening a file to write the image to, then print it to the > handle, then open the image in a image viewer.... > > As an option first try to capture the output of the script to a file and > open that in the image viewer: > > ./helloworld2 > output.png > > The other messages are just warnings that we can help you get rid of later. > > http://danconia.org > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]