Jump to content

Using Image Data

Recommended Posts


I want to work with the image data of a jpeg-image like in this example:


On a webserver it works fine, but if I test locally I get an error


index.html:16 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.

Isn't it possible to work locally? How do I have to change the script in order to run it locally?

I will work with my (young) students with javascript and would like to work locally.

Best Regards

Share this post

Link to post
Share on other sites

Browsers have security in place to prevent local scripts from mining information from the user's computer. Aside from that, if the image you are loading is not on your computer then the cross-origin protection will apply.

I would suggest installing server software, such as XAMPP, on your computer.


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...