UNPKG

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