Closed lorvent closed 8 years ago
We talked about this in #27. Two problems that still exist are licensing and overhead.
It's easy enough to use color-thief-php on its own, so doubling the size of SimpleImage just to support one feature and having to worry about licensing conflicts isn't really worth it at this point.
why we need to use that package code?
its a simple code where we have to find color of each pixel then find out which is used most,
there are many examples exists in SO aswell.
infact i never know about that package too.
The library I linked to is a fork of color-thief. You can see how well the dominant color and palettes are generated in the demo. It uses quantize.js to achieve spot on results.
To use color-thief-php, simply require it:
composer require ksubileau/color-thief-php
And grab the dominant color like this:
$dominantColor = \ColorThief\ColorThief::getColor($image);
To get a full color palette, do this instead:
$palette = \ColorThief\ColorThief::getPalette($image, 8);
Hello, Great library, want to use for some batch operations on cli.
do you have any plans to add to find which color is most used in an image?
Thanks.