There is a program for doing this:
<?php
function imageToHTML($img)
{
$width = imagesx($img);
$height = imagesy($img);
for($i = 0; $i < $height; $i++)
{
for($j = 0; $j < $width; $j++)
{
$color = str_pad(base_convert(imagecolorat($img, $j, $i), 10,
16), 6, '0', STR_PAD_LEFT);
echo "<div style=\"position: absolute;
background-color:#{$color}; height: 1px; width: 1px; top: {$i}px;
left:{$j}px;\"></div>\n";
}
}
}
$img = imagecreatefromjpeg($argv[1]);
imageToHTML($img);
?>
Usage:
/usr/bin/php image2html.php myimage.jpg > myimage.html
Enjoy!
--
--
-- Matthew Frederico
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net