Method | Description | |
---|---|---|
getColor ( mixed $sourceImage, integer $quality = 10, array $area = null ) : array | boolean | Use the median cut algorithm to cluster similar colors. | |
getColorIndex ( integer $red, integer $green, integer $blue, integer $sigBits = self::SIGBITS ) : integer | Get reduced-space color index for a pixel | |
getColorsFromIndex ( integer $index, integer $rightShift = self::RSHIFT, integer $sigBits = 8 ) : array | Get red, green and blue components from reduced-space color index for a pixel | |
getPalette ( mixed $sourceImage, integer $colorCount = 10, integer $quality = 10, array $area = null ) : array | Use the median cut algorithm to cluster similar colors. | |
naturalOrder ( integer $a, integer $b ) : integer | Natural sorting |
Method | Description | |
---|---|---|
isClearlyVisible ( object $color ) : boolean | ||
isNonWhite ( object $color ) : boolean |
Method | Description | |
---|---|---|
doCut ( string $color, |
||
getHisto ( array $pixels ) : array | Histo: 1-d array, giving the number of pixels in each quantized region of color space | |
getVBoxColorRanges ( |
||
loadImage ( mixed $sourceImage, integer $quality, array $area = null ) : SplFixedArray | ||
medianCutApply ( array $histo, |
||
quantize ( SplFixedArra\SplFixedArray | array $pixels, $maxColors ) : boolean | |
||
quantizeIter ( colorthief\PQueue &$priorityQueue, float $target, array $histo ) | Inner function to do the iteration | |
rearrangeColors ( array $order, integer $color1, integer $color2, integer $color3 ) : array | ||
sumColors ( string $axis, array $histo, |
Find the partial sum arrays along the selected axis. | |
vboxFromHistogram ( array $histo ) : |
public static getColor ( mixed $sourceImage, integer $quality = 10, array $area = null ) : array | boolean | ||
$sourceImage | mixed | Path/URL to the image, GD resource, Imagick instance, or image as binary string |
$quality | integer | 1 is the highest quality. There is a trade-off between quality and speed. The bigger the number, the faster the palette generation but the greater the likelihood that colors will be missed. |
$area | array | |
return | array | boolean |
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 |
protected static isClearlyVisible ( object $color ) : boolean | ||
$color | object | |
return | boolean |
protected static isNonWhite ( object $color ) : boolean | ||
$color | object | |
return | boolean |