- 使用canvas把图片转换为file格式的图片,但是打印缺少name
let that = this
var canvas = document.createElement('CANVAS')
var ctx = canvas.getContext('2d')
var img = new Image;
img.crossOrigin = 'Anonymous';
img.onload = function () {
canvas.height = img.height;
canvas.width = img.width;
let quality = 0.5
ctx.drawImage(img, 0, 0, 400, 400);
var dataURL = canvas.toDataURL(outputFormat || 'image/png', quality);
let resultFile = that.dataURLtoFile(dataURL)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…