briangonzalez / jquery.adaptive-backgrounds.js

🦎 A jQuery plugin for extracting the dominant color from images and applying the color to their parent.
http://briangonzalez.github.io/jquery.adaptive-backgrounds.js/
6.54k stars 454 forks source link

Image with wrong Dominant Colors #84

Open hugorojasppm opened 6 years ago

hugorojasppm commented 6 years ago

I if use this example image: http://cdn.laprensa.com.ni/wp-content/uploads/2015/09/270915espElChipotephoto05.jpg

Got as dominant color,

rgb(255,255,253)

I want specifically detect if the dominant color is white, and this image does not. Yet I am getting this image as a valid one when is not?

I used the base-single.html from demo folder. How this can be solved?

AlfredJKwack commented 6 years ago

Hi,

I've added a CodePen with your example image (converted to Base64 inline to avoid CORS) as well as one using the underlying library (rgbaster.js). The dominant color as detected - at least on OSX Chrome and Safari, more on that below - appear to be rgb(255,255,255) and the secondary is rgb(255,255,253).

With regards to why you may be getting the wrong perceived colour, you may want to read through the comments on the below two issues:

I hope this helps.