DEV Community

Discussion on: How to base64 encode an image in javascript

Collapse
 
dantenl profile image
dante-nl

I get "Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'" when I use it like this: console.log(imgToBase64(img))