4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=ISO-8859-1">
5 <title>JPEG image decoding
</title>
10 var image_width
= 1024;
11 var image_height
= 1024;
15 for (i
= 0; i
< nb_images
; ++i
) {
16 var canvas
= document
.createElement("canvas");
17 canvas
.width
= image_width
;
18 canvas
.height
= image_height
;
19 var ctx
= canvas
.getContext("2d");
20 ctx
.fillStyle
= "rgb("+
21 Math
.floor(Math
.random()*256)+","+
22 Math
.floor(Math
.random()*256)+","+
23 Math
.floor(Math
.random()*256)+")";
24 ctx
.fillRect(0,0,image_width
,image_height
);
25 // If quality is 1, then we get YUV 444 encoding
26 // If quality is <1, then we get YUV 420 encoding
27 urls
[i
] = canvas
.toDataURL("image/jpeg", 0.99);
32 document
.getElementById("myimg").src
= urls
[idx
];
34 if (idx
>= nb_images
) { idx
= 0; }
35 window
.setTimeout(redraw
, 1);
37 window
.setTimeout(redraw
, 1);