<?php
  $image = imagecreatefromgif("Ic.gif");
  if ($image) {
   echo '<pre>';
    $width = imagesx($image);
    $height = imagesy($image);
    for($y = 0; $y < $height; ++$y) {
      for($x = 0; $x < $width; ++$x) {
        $thiscol = imagecolorat($image, $x, $y);
        $rgb = imagecolorsforindex($image, $thiscol);
        $htmlcol = sprintf("#%2X%2X%2X", $rgb['red'], $rgb['green'], $rgb['blue']);
        $char = "<font color=\"$htmlcol\">8</font>";
        echo $char;
      }
      echo "\n";
    }
    echo '</pre>';
  }
?>
