Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var match = strSvg.match(/svg width="(\d+)pt" height="(\d+)pt"/);
var width = match[1];
var height = match[2];
image.src = "data:image/svg+xml," + encodeURIComponent(svg);
var cElement = document.createElement("canvas");
cElement.width = width * 2;
cElement.height = height * 2;
var cContext = cElement.getContext("2d");
cContext.fillStyle = "#fff";
cContext.fillRect(-10, -10, width * 3, height * 3);
cContext.drawImage(image, 0, 0, width * 2, height * 2);
var png = cElement.toDataURL("image/png");
var image = nativeImage.createFromDataURL(png);
clipboard.writeImage(image);
alert("Copied Image to Clipboard");
})();
});
gen.out.on('end', () => {
var buffer = Buffer.concat(chunks)
var image = nativeImage.createFromBuffer(buffer)
clipboard.writeImage(image)
})
}