image-to-ascii-art
Version:
convert image to ascii art in browser
28 lines (27 loc) • 732 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>Document</title>
</head>
<body>
<pre style="font-family: monospace;"></pre>
<script src="../../dist/image-to-ascii-art.js"></script>
<script>
const imageToAsciiArt = new ImageToAsciiArt({
config: {
drawWidth: 1,
drawHeight: 0.5,
// pickDensityHorizontal: 14,
// pickDensityVertical: 7
}
});
imageToAsciiArt.convert('./test.jpg').then(result => {
document.querySelector('pre').innerHTML = result;
});
imageToAsciiArt.destroy();
</script>
</body>
</html>