drewdaemon / drewdaemon/angular-image-annotator

ERROR DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

Open
#17 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3
Forks
16
PR merge metrics
No merged PRs in 30d

Description

I used the following tag to load the image:

```

```

I used the following function in my component to save the return Url from `getAnnotatedImage()` function call:

```
save() {
let saved = this.annotator.getAnnotatedImage('image/png');
if (saved)
this.mySavedImage = saved;
}
```
but it failed with the following error:

```
ERROR DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
at AiaImageAnnotatorComponent.getAnnotatedImage (http://localhost:4200/vendor.js:71813:28)
at AppComponent.save (http://localhost:4200/main.js:168:36)
at AppComponent_Template_button_click_171_listener (http://localhost:4200/main.js:493:147)
at executeListenerWithErrorHandling (http://localhost:4200/vendor.js:26822:16)
at wrapListenerIn_markDirtyAndPreventDefault (http://localhost:4200/vendor.js:26864:22)
at HTMLButtonElement. (http://localhost:4200/vendor.js:60166:38)
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:412:35)
at Object.onInvokeTask (http://localhost:4200/vendor.js:44161:33)
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:411:40)
at Zone.runTask (http://localhost:4200/polyfills.js:180:51)
```

I tried to save when it has not been edited, it failed the same way. Is the save function implemented in this tool?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing AppComponent.save(), which calls AiaImageAnnotatorComponent.getAnnotatedImage('image/png'), and inspect the canvas export path associated with that entry point. Determine the expected behavior for an unedited image and whether the reported failure is handled by the library; done means the expected save behavior is established and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.