I need to create color palette with PHP. I use code like this:
for ($x = 0; $x < $this->width; $x += $level) {
for ($y = 0; $y < $this->height; $y += $level) {
$index = imagecolorat($this->workingImage, $x, $y);
$rgb = imagecolorsforindex($this->workingImage, $index);
$color = $this->getClosestColor($rgb["red"], $rgb["green"], $rgb["blue"]);
$hexarray[] = $this->RGBToHex($color[0], $color[1], $color[2]);
}
}
How can I do it? For any picture I need at least 10 colors. I am tried to use another methods, pixelate image before receiving color palette, but it is not helping for me.
