-
Notifications
You must be signed in to change notification settings - Fork 0
/
test copy.html
52 lines (41 loc) · 1.31 KB
/
test copy.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pixel Artist Test Page</title>
<!-- <script src="dist/jimp.min.js"></script> -->
<script src="dist/pixel-artist.bundle.js"></script>
</head>
<body>
<h1>Test pixel artist</h1>
<script>
Jimp.read("pics/apple.png").then(function (img)
{
// Adds duck picture to end of document
img.getBase64(Jimp.AUTO, function (err, src)
{
var elem = document.createElement("img");
elem.setAttribute("src", src);
document.body.appendChild(elem);
});
// Adds processed picture to end of document
var paletteName = "AAP64";
var pa = new pixart.PixelArtist(pixart.palettes[paletteName]);
pa.setTransparency(new pixart.Color("#FF00FF"));
pa.setOutline(1, "Black", false);
pa.setEdge(3, "White", false, -0.5);
pa.setDithering(pixart.matrices["Bayer8x8"], 0.79);
pa.setFinalFrame(2);
pa.setWrapMode(pixart.WrapMode.Uniform, pixart.WrapMode.Uniform,
pixart.WrapMode.Uniform, pixart.WrapMode.Uniform, 0xFF00FFFF);
let res = pa.render(img);
res.getBase64(Jimp.AUTO, function (err, src)
{
var elem = document.createElement("img");
elem.setAttribute("src", src);
document.body.appendChild(elem);
});
});
</script>
</body>
</html>