Get image data url in JavaScript?

后端 未结 8 2043
南笙
南笙 2020-11-21 05:11

I have a regular HTML page with some images (just regular HTML tags). I\'d like to get their content, base64 encoded preferably, without the need

8条回答
  •  太阳男子
    2020-11-21 05:47

    In HTML5 better use this:

    {
    //...
    canvas.width = img.naturalWidth; //img.width;
    canvas.height = img.naturalHeight; //img.height;
    //...
    }
    

提交回复
热议问题