Ich versuche ein neues leeres Bild mit Breite und Höhe zu erstellen und es als PNG in Datei zu speichern.Erstellen und Speichern von neuen PNG-Bildern in JavaScript
Dies ist, was ich habe:
var myImage = new Image(200, 200);
myImage.src = 'picture.png';
window.URL = window.webkitURL || window.URL;
var contentType = 'image/png';
var pngFile = new Blob([myImage], {type: contentType});
var a = document.createElement('a');
a.download = 'my.png';
a.href = window.URL.createObjectURL(pngFile);
a.textContent = 'Download PNG';
a.dataset.downloadurl = [contentType, a.download, a.href].join(':');
document.body.appendChild(a);
ich mit bestimmten Breite und Höhe in var myImage new Image(200, 200)
als die Ausgabe auf der Download-transparentes Bild zu bekommen versuchen.