Sha256: a3ffd1ad9b92e051baac30b934351dbd430638ac3cec4eece6faaac73e1a8bc5
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
const opacity = document.querySelector("#opacity") const batchConversion = async (file, indexValue) => { return new Promise((resolve, reject) => { if (file) { const reader = new FileReader() reader.readAsDataURL(file) reader.onload = (e) => { if (e.target.result) { let image = new Image() let canvas = document.createElement('canvas') canvas.setAttribute('id', 'canvas-img') let ctx = canvas.getContext('2d') image.onload = () => { canvas.width = image.width canvas.height = image.height ctx.globalAlpha = opacity.value ctx.drawImage(image, 0, 0, canvas.width, canvas.height) resolve([indexValue, canvas.toDataURL('image/png'), "image"]) } image.src = e.target.result } } } }) }
Version data entries
7 entries across 7 versions & 1 rubygems