Save many canvas element as image

后端 未结 1 494
梦谈多话
梦谈多话 2020-12-03 03:27

I have 3 layers of canvas - 1 is matrix, 2 & 3 is graphics, how to preserve them in one image?

相关标签:
1条回答
  • 2020-12-03 04:23

    You can draw one canvas into another with ctx.drawImage(other_canvas,0,0)

    If you do that in the right order, you will have all the canvas contents correctly layered in one of them.

    If you want to save the image, you can call canvas.toDataURL() to get the contents as a base64 encoded PNG file.

    0 讨论(0)
提交回复
热议问题