nolanlawson/blob-util

Tainted Canvas Error blobUtil.imgSrcToBlob

ifahadkhan opened this issue · 1 comments

Hi,
I am getting error :
DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.

My code is :
blobUtil.imgSrcToBlob('http://scentglobal.com/ScentImage/VIALS.jpg','image/jpeg',).then(function (imgblob) {...}

When I try to use Anonymous for Cors I get error:

Access to Image at 'http://scentglobal.com/ScentImage/VIALS.jpg' from origin 'http://localhost:8100' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.

Any idea what I am doing wrong here.

You have to enable CORS on the server hosting the images, and then use anonymous. See Stack Overflow for details: https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present