http://qs321.pair.com?node_id=106424


in reply to Random Pictures Using .pngs ... how?

GD can do this (and more). Here's a quick 'n' dirty example that will create a 100x100 pixel PNG and spew it to STDOUT (so make sure you redirect to a file in your shell).

use strict; use GD; my $im = new GD::Image(100,100); my @colors; # Preallocate colors, since PNG has a limited number of co +lors for (0..255) { $colors[$_] = $im->colorAllocate(int(rand(256)),int(rand(256)),int(r +and(256))); } for my $x (0..99) { for my $y (0..99) { $im->setPixel($x,$y,$colors[int(rand(255))]); } } binmode STDOUT; print $im->png;
"One word of warning: if you meet a bunch of Perl programmers on the bus or something, don't look them in the eye. They've been known to try to convert the young into Perl monks." - Frank Willison