将图像映射到图像文件 [英] Canvas Image to an Image file

查看:115
本文介绍了将图像映射到图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个画布上的用户签名,现在,而不是将其转换为一个基本的64字符串,我只是想将其保存为图像itslef。

解决方案

你可以很容易地做到这一点(指定格式为 png ):

  var img = canvas.toDataURL(image / png); 

您可以指定不同的图像格式。
查看此回答。 / p>

So i have a canvas on which the user signs, now instead of converting it to a base 64 string i simply want to save it as an image itslef. whats the easiest way to do it html5??

解决方案

You can easily do that this way (specifying the format as png in this case):

var img = canvas.toDataURL("image/png");

You can specify different image formats. Take a look at this answer.

这篇关于将图像映射到图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆