Use the median cut algorithm to cluster similar colors.
public static getPalette ( mixed $sourceImage, integer $colorCount = 10, integer $quality = 10, array $area = null ) : array | ||
$sourceImage | mixed | Path/URL to the image, GD resource, Imagick instance, or image as binary string |
$colorCount | integer | It determines the size of the palette; the number of colors returned. |
$quality | integer | 1 is the highest quality. |
$area | array | |
return | array |