jariz / vibrant.js

Extract prominent colors from an image. JS port of Android's Palette.
http://jariz.github.io/vibrant.js/
MIT License
4.61k stars 236 forks source link

new Vibrant() on <img style="display:none"> is a really bad idea #16

Closed dayvonjersen closed 6 years ago

dayvonjersen commented 9 years ago

Causes Firefox and Chrome to grind to a complete halt :\

"But why would you hide the image that you're trying to accentuate I don't even what"

I'm doing some dynamic styling in the browser and I was hoping to hide the image element itself, using it only as the source to script in a background-image with background-size: cover and dynamic background/text overlay color values (provided by Vibrant.js)

But that's besides the point, checking the image dimensions or display properties before copying the image to a new canvas element might be a good idea idk

Love the library, ran into this just now, thought I'd say something =)

m-roll commented 8 years ago

Did you ever resolve this? I am actually trying to do the same thing and am running into all kinds of problems.

dayvonjersen commented 8 years ago

If you're asking me that question, then yes I resolved it by not doing that and instead re-inventing the wheel.