node ascii 转换_使用Node.js将图像转换为ASCII Art
node ascii 转换
There are many people out there that don’t appreciate ASCII art; we call those people “idiots”. ASCII art has been used forever and remains, in my opinion, a feat of programming and creativity. There’s a project called image-to-ascii which doesn’t just create ascii art but does so from an image of your choosing. Baller!
有很多人不喜欢ASCII艺术。 我们称这些人为“白痴”。 在我看来,ASCII艺术已被永久使用,并且仍然是编程和创造力的壮举。 有一个名为“ 图像转ascii”的项目,它不仅可以创建ascii艺术,还可以根据您选择的图像来创建。 鲍尔!
Assuming you’ve installed dependencies, outputting an image to ASCII art in the console is fairly simple:
假设您已经安装了依赖项,则在控制台中将图像输出为ASCII图像非常简单:
var ImageToAscii = require('image-to-ascii');
ImageToAscii(__dirname + '/logo.png', function(err, converted) {
console.log(err || converted);
});
Short bit of code for a cool effect. You’ll want to size the image down to less than 200px for best display and even then the ASCII output within the console looks excellent. As I mentioned in Show Images in Console with Node.js console-png, adding graphical elements to the console can be a nice touch and enhancement from bland text!
简短的代码可带来炫酷效果。 您可能希望将图像缩小到小于200像素,以获得最佳显示效果,即使如此,控制台内的ASCII输出看起来也很出色。 正如我在使用Node.js console-png在控制台中显示图像中提到的那样,向控制台添加图形元素可以使平淡的文本变得很不错,并且得到了增强!
翻译自: https://davidwalsh.name/convert-image-ascii-art
node ascii 转换
还没有评论,来说两句吧...