lokesh / color-thief

Grab the color palette from an image using just Javascript. Works in the browser and in Node.

Home Page:https://lokeshdhakar.com/projects/color-thief/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The canvas has been tainted by cross-origin data

itsmnthn opened this issue · comments

Hello,

I am using color thief js locally and using remote image URL to find the color, I am getting this error Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. I'm getting this error and then not getting colors obviously but I see images loaded on canvas and that is visible on the body.

Though I'm handling error in my code, ColorThief leaves the canvas on the body on an error. please make sure on the error you clear the DOM or memory used while finding color.

It would be better if you put a class or something to identify the canvas created by ColorThief. so it would be possible to tweak ColorThief canvas to hide on error or something.

+1