-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiff2bmpsw.html
37 lines (37 loc) · 1.44 KB
/
tiff2bmpsw.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
<!DOCTYPE html>
<title>Load TIFF image using ServiceWorker and emscripten</title>
<body>
<script>
function register() {
navigator.serviceWorker.register("./tiff2bmpsw.js",
{scope: "./"})
.then(function(e) {
alert("ServiceWorker registration succeeded.");
location.reload();
})
.catch(function(e) {
alert("ServiceWorker registration error.");
console.log(e);
});
}
</script>
<h1>Load TIFF image using ServiceWorker and emscripten</h1>
<div>
Source: <a href="https://github.com/horo-t/tiff2bmpsw">https://github.com/horo-t/tiff2bmpsw</a><br>
<br>
This page is a demo of ServiceWorker.<br>
<br>
Chrome can't load TIFF images.<br>
But you can see the image below after clicking the button.<br>
This button registers a <a href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/">ServiceWorker</a> which converts TIFF file to BMP file.<br>
This ServiceWorker is using <a href="http://www.remotesensing.org/libtiff/">LibTIFF</a> library which is compiled to JavaScript by <a href="https://github.com/kripken/emscripten">Emscripten</a>.<br>
You can inspect the ServiceWorker from <b>chrome://inspect/#service-workers</b>.<br>
<br>
If you are using Chrome 39, you have to enable "enable-experimental-web-platform-features" in chrome://flags.<br>
<br>
</div>
<div>
<img src="cherry_blossom.tif"></br>
<input type="button" onclick="register()" value="Please click">
</div>
</body>