-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestAnimDump.html
More file actions
46 lines (43 loc) · 1.34 KB
/
testAnimDump.html
File metadata and controls
46 lines (43 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>test</title>
<meta name=color-scheme content="dark light">
<meta name=viewport content=width=device-width,initial-scale=1.0>
<script src=anim_dump.js></script>
</head>
<body>
<h1>test</h1>
<label for="img-select-file">Upload images:</label>
<input type=file id="img-select-file" accept="image/webp" />
<script>
async function wrapper() {
var fileInput=document.getElementById("img-select-file")
var imgArrayBuf=await fileInput.files[0].arrayBuffer()
var printLog='';
const module = {
arguments: ["input.webp"],
preRun: () => {
module.FS.writeFile("input.webp", new Uint8Array(imgArrayBuf));
},
postRun: () => {
let output = module.FS.readFile("dump_0000.png", {encoding: "binary"});
download(new File([output], fileInput.files[0].name+"-output.png"))
let output2 = module.FS.readFile("dump_0001.png", {encoding: "binary"});
download(new File([output2], fileInput.files[0].name+"-output2.png"))
},
};
await AnimDump(module);
}
document.querySelector("input#img-select-file").addEventListener("change", wrapper)
function download(file) {
const link = document.createElement('a')
const url = URL.createObjectURL(file)
link.href = url
link.download = file.name
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
}
</script>