thephpleague / color-extractor

Extract colors from an image like a human would do.
thephpleague.com
MIT License
1.3k stars 159 forks source link

Get the main colors of each side #10

Closed celtric closed 10 years ago

celtric commented 10 years ago

Would it be possible to get the main color of top/right/bottom/left sides of an image?

For example, you have a logo and want to match the background automatically with the outside of the logo (if I'd have a Coca-Cola logo, I'd want to use red, not white, even though white might be used more).

MatTheCat commented 10 years ago

Hi. The algorithm I use doesn't consider the background apart but light grayscales get a very low score. You can test on a Coca-Cola logo, red will always be returned first.

celtric commented 10 years ago

Ah, I see. I'll extend the class then and only look for the outside coordinates, while using the algorithm. Thanks!