#! perl -sw use strict; #$| = 1; use GD; use CGI ":all"; my $im = GD::Image->newFromPng("m.png"); my ($width, $height) = $im->getBounds(); my $result; for my $y (0 .. $height) { $result .= "
\n"; for (my $x=0; $x < $width; $x++) { my $color = $im->getPixel($x, $y); my $n=1; # ++$n while $color == $im->getPixel(++$x, $y) and $x <= $width; $result .= font( { color=> sprintf "%02x%02x%02x", $im->rgb($color) } ,'#' x $n ); # --$x; } } print header,$/; print substr($result, $_*60000, 60000) for 0 .. int(length($result)/60000); print end_html;