diff --git a/index.html b/index.html index 8e99d05..8dff15a 100644 --- a/index.html +++ b/index.html @@ -459,6 +459,7 @@
+
@@ -969,7 +970,9 @@ // Handle selecting an image with the file picker function handleImageSelection(evt){ - var files = evt.target.files; + var files = Array.from(evt.target.files); + files.sort((a, b) => a.name > b.name); + onlyImagesFileError.style.display = "none"; files.length > 0 ? @@ -1246,6 +1249,28 @@ navigator.clipboard.writeText(__output); } + function downloadFile() { + raw = []; + images.each((image) => { + data = imageToString(image) + .split(',') + .map(s => s.trim()) + .filter(Boolean) + .map((byte) => parseInt(byte, 16)); + raw = raw.concat(data); + }); + data = new Uint8Array(raw); + a = document.createElement("a"); + a.style = "display: none"; + document.body.appendChild(a); + blob = new Blob([data], {type: "octet/stream"}); + url = window.URL.createObjectURL(blob); + a.href = url; + a.download = getIdentifier() + ".bin"; + a.click(); + window.URL.revokeObjectURL(url); + } + // Use the horizontally oriented list to draw the image function listToImageHorizontal(list, canvas){