Closed joeworkman closed 2 years ago
Agreed. It returned literally everything, i only want to know the top 5 most used ones :(
I guess what you are looking for ist the ColorExtractor (as described in the Readme)?
$palette = Palette::fromFilename('./some/image.png');
$extractor = new ColorExtractor($palette);
// extract() returns the most “representative” colors
$colors = $extractor->extract(5);
I guess that was it ¯_(ツ)_/¯
I love the interface of this package. However, the palette that it generates contains the color value of every pixel it seems, even if the colors are nearly indistinguishable. I would love to be able to find the 5 most used colors that are actually in different color spectrums instead of 5 colors that are practically the same color.
I have been using this package to find a good color palette https://github.com/ksubileau/color-thief-php but its interface is not quite as nice as this one.