I’d like to use Color Thief, a script which allows you to extract the dominant color of an image.
Unfortunately I’m not able to get the code to work. I’d like the do
I've had the same problem, and solved it this way :
// get my image url
var imageUrl = '//myimage.ulr.com';
// than create an image elm, the sizes are needed. 360x360 on this case
var image = new Image(360, 360);
image.onload = function(){
// act only after image load
console.log(image);
// than colorThief and get the color value
var colorThief = new ColorThief();
var color = colorThief.getColor(image);
console.log(color);
};
image.src = imageUrl;
Hope it helps anyone