Extract colors from an image like a human would do.
Include ColorExtractor
class as you want and call its extract
method:
<?php
include 'path/to/ColorExtractor.php'
$palette = ColorExtractor::extract(/* … */);
parameter | description | default value |
---|---|---|
imageResource | image resource identifier, as returned by imagecreatefromjpeg | - |
maxPaletteSize | maximum size of the colors array returned by ColorExtractor::extract | 1 |
minColorRatio | minimum ratio below colors are ignored (0 - 1) | 0 |
minSaturation | minimum saturation level below colors are ignored (0 - 1) | 0 |
Returns an array with hexadecimal codes of dominant colors.