public function getColorMap()
{
$colors = array();
$iw = $this->getImageWidth();
$ih = $this->getImageHeight();
for ($h = 0; $h < $ih; $h++) {
$colors[$h] = array();
for ($w = 0; $w < $iw; $w++) {
$a = imagecolorat($this->image, $w, $h);
$b = imagecolorsforindex($this->image, $a);
$colors[$h][$w] = $b;
}
}
return $colors;
}