forked from notmasteryet/jpgjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
42 lines (39 loc) · 2.31 KB
/
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
39
40
41
42
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<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");
displayImage("c4", "data:image/jpeg;base64,/9j//gAQTGF2YzU2LjEyLjEwMQD/2wBDAAgEBAQEBAUFBQUFBQYGBgYGBgYGBgYGBgYHBwcICAgHBwcGBgcHCAgICAkJCQgICAgJCQoKCgwMCwsODg4RERT/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsBAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKCxAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/wAARCAAUABQDASIAAhEAAxEA/9oADAMBAAIRAxEAPwBhlubrUXnbaC1rYSS44CiWMZP0B4rcFnpM9vHqOlalaRLCvk37zSn7KnKM8iONzb1QMfLGcnB45ri9cuZHtYkEvkLJo9lPdsufM8nysbEHXcWHQ8ZHJAzWhfTQah4W0fTLbzYrTULq2TYqj7PCFikEgL+UCOWB+Zt0j7mORXIsIoUqbqf8vNkloore/wB2h9VXrVKsn7GfIqXxdnzdLdRkXhK88Xb9av8AUrqxN3I8lvb2uUjW2z+6cjB+eUZlb/fp/wDwq6H/AKDuq/8Aff8A9jXYWVv4ajsrZr/WbaweSPdDAbm3i2wBmjjIWQ5wdhwenpUmzwR/0Mtp/wCBtp/jUfXpR0irJaJcl7JHO8Qr6uf4nmPissutJtZl/wCJTYR8H+GWM7uueeTiu10iNYPDmp20fyxx6Y00Ywp2SwbXjkGQRuVuc4rivFn/ACG1/wCwZpf/AKLrt9N/5A2r/wDYHuf/AEAVtjm/Z4H5/maYdL6vi3/17OK1zVbu61GSSQoThYwNoAVIh5SKo7AKo/HNVPts3+x/3zTtU/4/Jf8Aef8A9GNVenCMeSOi2XTyA//Z");
}
</script>
</head>
<body onload="loadImages()">
<table>
<tr><th>baseline</th><th>progressive</th><th>baseline (gray)</th><th>dataurl</th></tr>
<tr>
<td><canvas id="c1"></canvas></td>
<td><canvas id="c2"></canvas></td>
<td><canvas id="c3"></canvas></td>
<td><canvas id="c4"></canvas></td>
</tr>
</table>
</body></html>