<分区>
Possible Duplicate:
Converting Canvas element to Image and storing in database
我有一个 Canvas 元素,我想要这个元素的“data:image/png;base64”。可以提取这个吗?
<分区>
Possible Duplicate:
Converting Canvas element to Image and storing in database
我有一个 Canvas 元素,我想要这个元素的“data:image/png;base64”。可以提取这个吗?
最佳答案
您可以使用 the toDataURL function of Canvas .它正是您所要求的。
var dataURLstring = canvas.toDataURL();
MDN 文档:HTML Canvas
Returns a data: URL containing a representation of the image in the format specified by type (defaults to PNG).
关于javascript - 是否可以提取数据 :image of canvas element?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14338923/