#!C:/Perl/bin/perl -w use strict; #$| = 1; use CGI::Carp "fatalsToBrowser"; use GD; use CGI ":all"; my $im = GD::Image->newFromPng("m.png"); # get the image size my ($width, $height) = $im->getBounds(); my $result; my $index; my $r; my $g; my $b; my $color; for (my $x = 0; $x < $height; $x++) { $result .= "
"; for (my $y = 0; $y < $width; $y++) { $index = $im->getPixel($y, $x); ($r,$g,$b) = $im->rgb($index); $color = sprintf "%02x%02x%02x", $r, $g, $b; $result.= font({color=>"$color"},"."); } } print header; print "$result\n"; print end_html;