-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
62 lines (55 loc) · 1.6 KB
/
index.html
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>gifken preview</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script type="module">
import {reverse, split} from '/src/gifken.ts'
const originalDiv = document.querySelector('#original')
originalDiv.innerHTML = ''
const reverseDiv = document.querySelector('#reverse')
reverseDiv.innerHTML = ''
const splitDiv = document.querySelector('#split')
splitDiv.innerHTML = ''
const imageUrl = '/01_Koch-Kurve-Sechseck-alt._Def.-2.gif'
const response = await fetch(imageUrl)
const buffer = await response.arrayBuffer()
{
const result = await reverse(new Uint8Array(buffer))
const img = new Image()
img.src = URL.createObjectURL(new Blob([result], {type: 'image/gif'}))
reverseDiv.append(img)
}
{
const img = new Image()
img.src = imageUrl
originalDiv.append(img)
}
{
const results = await split(new Uint8Array(buffer))
for (const result of results) {
const img = new Image()
img.src = URL.createObjectURL(new Blob([result], {type: 'image/gif'}))
splitDiv.append(img)
}
}
</script>
<style>
img {
border: 1px solid #ddd;
height: 350px;
object-fit: cover;
}
</style>
</head>
<body>
<h1>gifken preview</h1>
<h2>original</h2>
<div id="original"></div>
<h2>reverse</h2>
<div id="reverse"></div>
<h2>split</h2>
<div id="split"></div>
</body>
</html>