Permalink
Browse files

add jpg.js to jpeg.html

  • Loading branch information...
1 parent ff249d2 commit 80d4001115dcc87f35c6d39b35c69dd2b8a1a001 @kig committed Jun 21, 2012
Showing with 956 additions and 0 deletions.
  1. +13 −0 jpeg.html
  2. +943 −0 jpg.js
View
@@ -1,5 +1,6 @@
<html>
<head>
+ <script src="jpg.js"></script>
<script src="DataStream.js"></script>
</head>
<body>
@@ -257,6 +258,18 @@ <h3>Select a JPEG or TIFF file</h3>
pre = document.querySelector('pre');
if (obj) {
pre.textContent = JSON.stringify(obj, null, 4);
+ if (obj.start) {
+ var j = new JpegImage();
+ j.parse(new Uint8Array(this.result));
+ var c = document.createElement('canvas');
+ c.width = j.width; c.height = j.height;
+ var ctx = c.getContext('2d');
+ var id = ctx.getImageData(0,0,j.width, j.height);
+ j.copyToImageData(id);
+ ctx.putImageData(id, 0,0);
+ c.style.display = 'block';
+ pre.appendChild(c);
+ }
} else {
pre.textContent = "Failed to parse JPEG at "+ds.failurePosition+" :(";
}
Oops, something went wrong.

0 comments on commit 80d4001

Please sign in to comment.