There are several beginner's bugs in this code:
1) You need to check the result of the open call: open (TEMP, "template.png") or die "Can't open template: $!"; 2) You need to call binmode() on the filehandle, not the result of the open call: open (GEN,">>test.png") or die "Can't open out file: $!"; binmode(GEN); 3) You must not place method or function calls in quotes: print GEN $graph->png; 4) You must close your files and check the result code: close GEN or die "Can't close GEN file: $!"; close TEMP or die "Can't close TEMP file: $!"; Lincoln [EMAIL PROTECTED] writes: > > Placed At : BOM > > > Durga Prasad@SATYAM > 11/07/2001 07:00 PM > > Hi all, > Iam generating a graph from data queried from a database. > I created a template with the background, Axes and units of measurement etc., so > that i need not do it everytime i want to generate this graph. > Also, i hope to put it up on the intranet so that everybody can do the same and > watch the graph. > Iam using GD.pm for this purpose. > How ever, when i try to read the template with the code: > ###Code Follows > open (TEMP, "template.png"); > $graph=GD::Image->newFromPng(\*TEMP); > close TEMP; > $graph->string(gdLargeFont,40,40,"manipulated",$black); > binmode open(GEN, ">>test.png"); > print GEN ("$graph->png"); > exit; > ###End Code > This code generates a file with the name test.png but it is visible on any > browser. > Unlikely too, for this file is about 32 bytes while the Template file is > 3000Bytes in size. > I guess iam not able to read the image right. > Can some body guide me in this issue? > Any pointers will be appreciated. > Regards, > Durga Prasad > -- ======================================================================== Lincoln D. Stein Cold Spring Harbor Laboratory [EMAIL PROTECTED] Cold Spring Harbor, NY NOW HIRING BIOINFORMATICS POSTDOCTORAL FELLOWS AND PROGRAMMERS. PLEASE WRITE FOR DETAILS. ======================================================================== -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]