{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/1617","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/1617/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/1617/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/1617/events","html_url":"https://github.com/kangax/fabric.js/issues/1617","id":41051554,"number":1617,"title":"can not apply filters on image from cross origin","user":{"login":"wajipk","id":3284833,"avatar_url":"https://avatars.githubusercontent.com/u/3284833?v=3","gravatar_id":"","url":"https://api.github.com/users/wajipk","html_url":"https://github.com/wajipk","followers_url":"https://api.github.com/users/wajipk/followers","following_url":"https://api.github.com/users/wajipk/following{/other_user}","gists_url":"https://api.github.com/users/wajipk/gists{/gist_id}","starred_url":"https://api.github.com/users/wajipk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wajipk/subscriptions","organizations_url":"https://api.github.com/users/wajipk/orgs","repos_url":"https://api.github.com/users/wajipk/repos","events_url":"https://api.github.com/users/wajipk/events{/privacy}","received_events_url":"https://api.github.com/users/wajipk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kangax/fabric.js/labels/needs_confirmation","name":"needs_confirmation","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-08-25T11:02:53Z","updated_at":"2015-04-07T08:08:20Z","closed_at":null,"body":"We are using the following code to load images on canvas\r\n\r\n` fabric.Image.fromURL(src, function(oImg) { \r\n\t\t\t/* other options for images*/`\r\n`\t\t\t\tcanvas.add(oImg);`\r\n`\t\t\t\tcanvas.calcOffset();`\r\n`\t\t\t}`\r\n`\t\t});`\r\n\r\nimage is loaded successfully on canvas, but when we apply filter on this image it will give a cross origin error. \"Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. \" \r\ni can't understand what is the problem.\r\n\r\nThanks in advance.\r\n@kangax @Kienz \r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4025226-can-not-apply-filters-on-image-from-cross-origin?utm_campaign=plugin&utm_content=tracker%2F23217&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F23217&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/comments/90448414","html_url":"https://github.com/kangax/fabric.js/issues/1617#issuecomment-90448414","issue_url":"https://api.github.com/repos/kangax/fabric.js/issues/1617","id":90448414,"user":{"login":"Kienz","id":954545,"avatar_url":"https://avatars.githubusercontent.com/u/954545?v=3","gravatar_id":"","url":"https://api.github.com/users/Kienz","html_url":"https://github.com/Kienz","followers_url":"https://api.github.com/users/Kienz/followers","following_url":"https://api.github.com/users/Kienz/following{/other_user}","gists_url":"https://api.github.com/users/Kienz/gists{/gist_id}","starred_url":"https://api.github.com/users/Kienz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kienz/subscriptions","organizations_url":"https://api.github.com/users/Kienz/orgs","repos_url":"https://api.github.com/users/Kienz/repos","events_url":"https://api.github.com/users/Kienz/events{/privacy}","received_events_url":"https://api.github.com/users/Kienz/received_events","type":"User","site_admin":false},"created_at":"2015-04-07T08:08:20Z","updated_at":"2015-04-07T08:08:20Z","body":"@wajipk The difference is, that the `crossOrigin` in the first examlpe is set before the image is loaded. In the second the attributes is added after the image is loaded. The `crossOrigin` attribute have to be set before the image request started.\r\n```js\r\nvar img = document.createElement('img');\r\n// have to be set before `src` attribute is set\r\nimg.crossOrigin = 'anonymous';\r\n\r\nimg.onload = function () {\r\n  console.log('image loaded');\r\n};\r\nimg.src = 'http://....';\r\n```"}}