function blobToImg (blob) {
return new Promise((resolve, reject) => {
let reader = new FileReader()
reader.addEventListener('load', () => {
let img = new Image()
img.src = reader.result
img.addEventListener('load', () => resolve(img))
})
reader.readAsDataURL(blob)
})
}
function ImageToCanvas(image,dom) {
const canvas = document.getElementById(dom)
canvas.width = image.width
canvas.height = image.height
canvas.getContext('2d').drawImage(image, 0, 0)// 0, 0参数画布上的坐标点,图片将会拷贝到这个地方
return canvas
}