We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, is it possible to only get the dominant color from a specific area in an image?
var canvas = document.getElementById('da-canvas'); var context = canvas.getContext('2d'); var img = new Image(); var colorThief = new ColorThief(); var bg; img.src = 'images/thefame.jpg'; img.onload = function() { canvas.height = 10; canvas.width = this.width; context.drawImage(img, 0, 0, this.width, this.height); bg = colorThief.getColor(canvas); canvas.height = this.height; context.drawImage(img, 0, 0, this.width, this.height); document.getElementById('container').style.background = 'rgb(' + bg.join(',') + ')'; }
I'm trying to get only 10px from the top of the image. I thought just setting the height of the canvas will work hahaha. But it didn't.
I think this might increase the speed as well?
The text was updated successfully, but these errors were encountered:
Here's the image I'm trying to use with this library:
Which results to rgb [38, 40, 50].
[38, 40, 50]
Sorry, something went wrong.
Duplicate, see #44
No branches or pull requests
Hi, is it possible to only get the dominant color from a specific area in an image?
I'm trying to get only 10px from the top of the image. I thought just setting the height of the canvas will work hahaha. But it didn't.
I think this might increase the speed as well?
The text was updated successfully, but these errors were encountered: