ImageMagick ¤òÄ´¤Ù¤Æ¥´¥Ë¥ç¥´¥Ë¥ç¤ä¤Ã¤Æ¤¿¤é GetPixels ¤Ê¤ó¤Ç¥á¥½¥Ã¥É¤¬¤¢¤ë¤Î¤ò¤Ï¤¸¤á¤ÆÃΤê¤Þ¤·¤¿¡£
¤Û¤ó¤È¤¦¤Ï¤½¤¦¤¤¤¦»ö¤¬¤ä¤ê¤¿¤¤¤ï¤±¤Ç¤Ï¤Ê¤«¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢¸½¼ÂƨÈòŪ¤Ë²èÁü¤ò HTML ¤Ë¤¹¤ë¥¹¥¯¥ê¥×¥È½ñ¤¤¤Æ¤ß¤Þ¤·¤¿¡£¡£

#!/usr/local/bin/perl
use strict;
use Image::Magick;

my $file = $ARGV[0];
my $image = Image::Magick->new;

my($x, $y, $size, $format) = $image->Ping($file);

$image->Read($file);
my @color_info = 
    $image->GetPixels(width=>$x, height=>$y, x=>0, y=>0, map=>'RGB');
print "<html><body>
";
my($i, $j) = (0, 0);
while (@color_info > 0) {
    my $r = num2hex(shift @color_info);
    my $g = num2hex(shift @color_info);
    my $b = num2hex(shift @color_info);
    my $rgb = "#$r$g$b";
    printf('<span style="position: absolute; left: %d; top: %d; width:1px; height:1px; background: %s"></span>', $i, $j, $rgb);
    $i++;
    if ($i == $x) {
        $i = 0;
        $j++;
        print "
";
    }
}
print "</body></html>";

sub num2hex{
    my $depth = shift;
    $depth = int($depth / 256);
    return unpack("H2", pack("C", $depth));
}
% ./image2html.pl logo.gif > logo.html
¤ß¤¿¤¤¤Ê´¶¤¸¤Ç»È¤¤¤Þ¤¹¡£ºî¤Ã¤Æ¤ß¤¿¤Î¤¬¤³¤Á¤é(¥Ö¥é¥¦¥¶¸Ç¤Þ¤ë²ÄǽÀ­¤¢¤ê¤Þ¤¹¤Î¤Ç¤´Ãí°Õ¤ò¡£¡£)
·ë¹½åºÎï¤Ë½ÐÍè¤ë¤Î¤Ç¡¢¥Ñ¥Ã¤È¸«¤Ç¤ÏHTML¤Èʬ¤«¤é¤Ê¤¤¤¯¤é¤¤¤Ç¤¹¡£
¤¢¤Þ¤êÂ礭¤¤²èÁü¤À¤È¥Ö¥é¥¦¥¶¸Ç¤Þ¤ê¤Þ¤¹¤¬¡¢¥¢¥¤¥³¥ó¤È¤«¤À¤Ã¤¿¤é»È¤¨¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£
¤½¤¦¤Þ¤Ç¤·¤Æ²èÁü¤ò»È¤ï¤Ê¤¤¥á¥ê¥Ã¥Èʬ¤«¤ê¤Þ¤»¤ó¤¬¡£¡£