Download canvas image on the fly

浪子不回头ぞ 提交于 2019-12-20 02:57:11

问题


I have <div id="qrcode"></div>

Then jquery.qrcode.js plugin creates over a` element with the QR Code.

So, i would like to put a <button> element in the page for downloading that "image" (it's a canvas element) created on the fly.

Is it possible to do that?


回答1:


jquery canvas image download

The saving of the image can be done using HTML5 blobs.

http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file-writing

You can get Blob out of the like done in this code:

https://github.com/miohtama/Krusovice/blob/master/src/tools/resizer.js



来源:https://stackoverflow.com/questions/12795595/download-canvas-image-on-the-fly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!