ArtSCII: Generate High-Quality ASCII Art From Any Image

ArtSCII banner

ArtSCII is my ASCII art generator. I started making it as a tool to help decorate this site, but I ended up deciding to properly finish it and release it as a command-line utility. I now believe it to be the highest quality ASCII art generator available online, although I am obviously biased. At the very least, it definitely has its own style.

The unique look of the outputs is achieved via kernel convolutions that stylize the input image before matching characters to it. The idea behind this was to encode some of the depth information from the image into the text, rather than just brightness values. I figured that if CNNs can use convolutions to classify objects in images, I should be able to find a combination of kernels that makes my output prettier. It took many hours of tweaking before I had an output that I was satisfied with, but in the end it came out well.

This program runs on .NET 4.5 (with recently added Linux support via Mono), and is written in a mixture of C and C#. It was initially all written in C#, but performance issues caused me to port the kernel convolution and character matching logic to OpenCL. I considered using CUDA instead, but ultimately the application does not require a huge amount of GPU compute, and I didn't want to artificially restrict hardware compatibility. The process of sharing data structures between the two languages was interesting to me, since I previously only made DLLs for use with the same language. It took more effort than I thought it would to get the data formatted correctly.

This was my first time writing a GPU-accelerated program. It was quite difficult, but in the end, I boosted the execution speed by an order of magnitude, and it taught me a great deal. I probably could have saved myself a significant amount of development time if I had gone with the C++ API instead of C, but I had used C++ plenty of times already and I wanted to change it up. The OpenCL device programming language is a version of C as well, so it seemed like a good time to dive into C.

Gallery

Select an image and drag the bar to show or hide ArtSCII's output.

Left: example image before being filtered through ArtSCII
Right: example image after being filtered through ArtSCII