forked from notmasteryet/jpgjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
38 lines (35 loc) · 846 Bytes
/
example.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
<!DOCTYPE html>
<html>
<head>
<script src="jpg.js"></script>
<script>
function displayImage(canvasId, url) {
var j = new JpegImage();
j.onload = function() {
var c = document.getElementById(canvasId);
c.width = j.width;
c.height = j.height;
var ctx = c.getContext("2d");
var d = ctx.getImageData(0,0,j.width,j.height);
j.copyToImageData(d);
ctx.putImageData(d, 0, 0);
};
j.load(url);
}
function loadImages() {
displayImage("c1", "j1.jpg");
displayImage("c2", "j2.jpg");
displayImage("c3", "j3.jpg");
}
</script>
</head>
<body onload="loadImages()">
<table>
<tr><th>baseline</th><th>progressive</th><th>baseline (gray)</th></tr>
<tr>
<td><canvas id="c1"></canvas></td>
<td><canvas id="c2"></canvas></td>
<td><canvas id="c3"></canvas></td>
</tr>
</table>
</body></html>