thephpleague / color-extractor

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

Calculate shades of black and very light colors as the most used color hex code #17

Closed HanafiAhmat closed 8 years ago

HanafiAhmat commented 10 years ago

Getting the blouse color for other color variations is working very well when I tried to extract the most used color hex code. Sample images: chiffon-top-green-edited

chiffon-top-purple-edited

However, I have to extract the three most used color hex code to get a shade of black color hex code. Sample image: chiffon-top-black-edited

Result: Array ( [0] => #1BA430 [1] => #FD9D91 [2] => #131313 <----- shade of black )

As for very light pink, I have to extract at least ten most used color hex code. Sample image: chiffon-top-pink-edited

Result: Array ( [0] => #910011 [1] => #C30F2C [2] => #DEA184 [3] => #C67864 [4] => #EA214F [5] => #D98084 <----- shade of pink [6] => #B85945 [7] => #FD7B6D [8] => #D5A74F [9] => #BA6676 <----- shade of pink )

I even tried changing the background color to black but a shade of pink is still not in the top 3. Sample Image: chiffon-top-pink-black-bg

Result: Array ( [0] => #910011 [1] => #D71F41 [2] => #DFA486 [3] => #000000 [4] => #DB726C <----- shade of pink [5] => #FCA395 <----- shade of pink [6] => #B8634F [7] => #934A55 <----- shade of pink ? [8] => #BC647A <----- shade of pink [9] => #D7A566 )

This is a great script and very easy to implement. Just left with this issue and it would be really perfect.

MatTheCat commented 10 years ago

Well it's not really an issue as the script doesn't return the most used colors but the most colorful ones (roughly) which explains why you get the skirt's. That being said it would be interesting to add this functionnality.

HanafiAhmat commented 10 years ago

Oooooo... it actually extracts the most colorful ones... ok now it is clearer. Yes please add this feature. :smile:
Thank you Mathieu.