blob: 6ed907891c399644a29e1e44af167efdc6a21715 (
plain)
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
|
<canvas id="mycanvas"></canvas>
<img id="result" onload="testDone()">
<script type = 'text/javascript'>
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
function testDone()
{
if (window.testRunner)
testRunner.notifyDone();
}
var image = new Image();
image.onload = function() {
var canvas = document.getElementById("mycanvas");
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext('2d');
ctx.drawImage(image, 0, 0);
canvas.toBlob(function(blob) {
url = URL.createObjectURL(blob);
result.src = url;
}, "image/jpeg", 0.2);
}
image.src = "resources/letters.png";
</script>
|