I know you are searching to resolve securityError while working with image and html canvas. You might be first encountered this solution, which saying
"Set crossOrigin='anonymous' before image.src. and use image in onload event handler" (Related SO questions: https://stackoverflow.com/questions/25753754/canvas-todataurl-security-error-the-operation-is-insecure https://stackoverflow.com/questions/20424279/canvas-todataurl-securityerror )
So, you've already tried, but failed. right?