17 Jun 2021

Image 2 ASCII - ascii art generator

收藏到CSDN网摘

Converting images to ASCII, aka. ASCII art, has been explored by developers long time ago back to the time of DOS age. It is more about having fun but there are also some really good publications around this topic. Someone implemented online services to convert uploaded images to ASCII art like THIS one

The first answer under THIS QUESTION has a very detailed explanation and experiments of different approaches to this problem. A simple and straightforward approach is to do a pixel-2-text mapping from the image the the result ASCII text file. To avoid making the text file overcrowded, developers use to have some carefully selected character lists to reduce the intense level (number of chars used). So the process is more like a classification process: 

(1) find out which category the current pixel falls into; 
(2) pick up the character that represents the current category; 
(3) walking through the image pixel by pixel and repeat the process to generate the result text file.