Convert and insert Base64 data to Canvas in Javascript

前端 未结 2 575
故里飘歌
故里飘歌 2020-12-29 13:32

I get a buffer of data represent an image in Base64. The data I got (represent image in base64) (part of the data)

193,109,51,74,182,71,212,38,78,62,211,48,81,

2条回答
  •  隐瞒了意图╮
    2020-12-29 14:03

    http://localhost:994/%FF%...... cannot be drawn on canvas.
    Your data sould look like "data:image/png;base64,iVBORw0..."
    If they look like this then they are ready for use without base64 decoding. You simply draw them directly using context.drawImage

提交回复
热议问题