bladx has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use GD; my ($width, $height) = (300,50); my ($rvalue, $gvalue, $bvalue, $total) = (255,255,255,256); my $im = new GD::Image($width,$height); #Allocate the colors that are going to be used my @colors; for (0..255) { $colors[$_] = $im->colorAllocate(int(rand($rvalue)),int(rand($gvalue +)),int(rand($bvalue))); } # Create image according to height/width proportions and given amount +of colors for my $width_length (0..$width-1) { for my $height_length (0..$height-1) { $im->setPixel($width_length,$height_length,$colors[int(rand($t +otal))]); } } # Set binmode to STDOUT binmode STDOUT; # Set output to be an image for CGI print "Content-Type: image/png\n\n"; # Standard output of created image print $im->png;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing setpixel size using GD.pm
by ChemBoy (Priest) on Aug 22, 2001 at 05:26 UTC | |
|
Re: Changing setpixel size using GD.pm
by myocom (Deacon) on Aug 22, 2001 at 05:10 UTC | |
|
Re: Changing setpixel size using GD.pm
by the_mind_ (Novice) on Aug 22, 2001 at 09:26 UTC |