1 | <!DOCTYPE html>
|
2 | <html>
|
3 | <head>
|
4 | <title>Jimp browser example 1</title>
|
5 | </head>
|
6 | <body>
|
7 | <h1>Demonstrates loading a local file using Jimp on the main thread</h1>
|
8 | <script src="../lib/jimp.min.js"></script>
|
9 | <script>
|
10 | Jimp.read(
|
11 | "https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"
|
12 | ).then(function (lenna) {
|
13 | lenna
|
14 | .resize(256, Jimp.AUTO)
|
15 | .quality(60)
|
16 | .greyscale()
|
17 | .getBase64(Jimp.AUTO, function (err, src) {
|
18 | var img = document.createElement("img");
|
19 | img.setAttribute("src", src);
|
20 | document.body.appendChild(img);
|
21 | });
|
22 | });
|
23 | </script>
|
24 | </body>
|
25 | </html>
|