in reply to Re: Images created in a loop grow
in thread Images created in a loop grow
Here is the code
#!/usr/bin/perl use GD; $maxx = 600; $maxy = 500; for ($x = 0; $x < 10; $x++) { # create a new image undef $im; $im = new GD::Image($maxx+50,$maxy); $im->trueColor(1); # allocate some colors $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,$maxx-1,$maxy-1,$black); $im->line(0, $maxy/2, $maxx, $maxy/2, $black); $png_data = $im->png; my $file = "TestImage". $x.".png"; open(DISPLAY,">$file") || die "open failed"; binmode DISPLAY; print DISPLAY $png_data; close DISPLAY; print "Output file = ".$file."\n"; undef $png_data; undef $im; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Images created in a loop grow
by zentara (Cardinal) on Apr 17, 2006 at 13:30 UTC | |
by gtm (Initiate) on Apr 17, 2006 at 16:40 UTC |