js base64编码格式图片另存为下载

原创 2017年02月22日 16:23:38

需求

网页中 base64编码过的图片,点击某按钮下载此图片

<img class="barcode" src="data:image/jpg;base64,base64编码">

风来了.fox

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>js base64编码格式图片另存为下载-风来了.fox</title>
</head>
<body>
<a id="tttt"></a>
<h2>图片</h2>
<p><img id="ringoImage" alt="" src="图片BASE64,在最下面找,替换本src"/></p>
<div><a onclick="down()" href="javascript:void(0);">下载图片</div>
<script src="/Public/static/jquery.min.js"></script>
<script>
/**
 * 根据图片生成画布
 */
function convertImageToCanvas(image) {
    var canvas = document.createElement("canvas");
    canvas.width = image.width;
    canvas.height = image.height;
    canvas.getContext("2d").drawImage(image, 0, 0);
    return canvas;
}
/**
 * 下载图片
 */
function down() {
    var sampleImage = document.getElementById("ringoImage"),
    canvas = convertImageToCanvas(sampleImage);
    url = canvas.toDataURL("image/png");//PNG格式
    //以下代码为下载此图片功能
    var triggerDownload = $("#tttt").attr("href", url).attr("download", "order-1111111111.png");
    triggerDownload[0].click();
//    triggerDownload.remove();
}
</script>
</body>
</html>

把图片base64编码放到 ringoImage 中的src中

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7A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3VhyZ95oG9d/HlbR+mJthA0IwipUfOyuJIi2XJi7gwcz1LGtcRjPpm3Pl49fjl89/n9u3/iIJGLJjAcV0Kg3Z1z3H9NiE4pE0XdkzFQ0aU7fu38uYlWwgETszcn+t+nC9tu4mEv56QL4btWgxWuqn3t3JJ5r2sbXkbiWQMLeyh67MHtb0y39r+Me79/R3EAyki/hiu51a5VIXCkP2UZih/Z4Y1tOnCjql4xBfnQP9uHty7lTef957j3cTKAJ++7z1oQicSSGK5ZUrOCGsbNnNl+0dpa5yPEhvLG2ZfJ+869ADfe+wW9nY/TTo6H101cD13opv+VhHiLWNCrSmq8E8H9vhECkEzwi9f+B6r2y4jFKj2h7/zyCfpHe4ik1yI7VawvTKr05u4suMjxGuilIMj6FLHc+V4E30mY7B4jK27vsK2PT9AFQbNiYUwmryMhSDgC8CnEMcTM3HjT87fl89a6enAToSu2AX8egR9tFIaLPTiN0LjJ0EgiJn1uNi4VABlNEzM7r9kynaB3pFOEoEUhmaOgeaB3wPbga3AEWT1Xw3CNQZmWON/BwDr0QaeDW4IKgAAAABJRU5ErkJggg==

参考
http://www.webhek.com/post/convert-canvas-image.html
http://www.2cto.com/kf/201404/293481.html

版权声明:原创文章欢迎转载,不过要记得加出处哦

相关文章推荐

js 下载Base64格式数据图片(兼容主流浏览器)

最近的工作内容和前端有关。需要做一个图片下载的功能,然而后台只提供了 byte[]  类型的图片数据,并且返回给前端的是Base64格式图片数据。那么,就遇到了最严重的问题了:浏览器兼容。 展示图片的...
  • Vir_czz
  • Vir_czz
  • 2017年03月02日 17:55
  • 3541

js小方法+Canvas 利用js 实现浏览器保存图片到本地

很多时候会看到 : 这都是固定好的,但是如果你有一天需要动态的去添加方法 或者是根据条件的去绑定点击事件下面的方法呢?需要调用js 的 元素.addEventListener(event, ...
  • SWSHBON
  • SWSHBON
  • 2016年06月07日 18:59
  • 11290

js本地预览图片和转base64

js本地预览图片和转base64
  • guo8ke
  • guo8ke
  • 2017年05月05日 13:57
  • 1429

用BASE64将二进制图片写到本地文件中

刚入行的菜鸟一枚,最近遇到一个问题就是将数据库中存储的照片写到生成的Word文档中。查阅了很多资料最终解决了这个问题。 我用的方法是在数据库中获取到存储的图片的二进制。将二进制流写到本地的文件夹中。然...

文件与base64与字符串之间的转换

本人是去年刚毕业的学生,第一次写技术类的博客,还请各位多多指教。 今天说的是文件与base64之间的转换,在做项目的时候会遇到一些本地或者客户端的文件上传到服务器上。我们可以用base64将文件转换成...

Delphi7高级应用开发随书源码

  • 2003年04月30日 00:00
  • 676KB
  • 下载

Delphi7高级应用开发随书源码

  • 2003年04月30日 00:00
  • 676KB
  • 下载

JS创建文件下载

var hrefvalue = "data:application/vnd.ms-excel;base64," + wbout; anchor.download = filename + '.txt'...

Delphi7高级应用开发随书源码

  • 2003年04月30日 00:00
  • 676KB
  • 下载

Delphi7高级应用开发随书源码

  • 2003年04月30日 00:00
  • 676KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:js base64编码格式图片另存为下载
举报原因:
原因补充:

(最多只允许输入30个字)