What is your preferred command line tool

Is there a command line program that can output ASCII art as an image?

Is there a command line program (for Linux) that can convert an image to ASCII art and then save that output as an image, e.g. B. jpg or png?

To illustrate what I need, I want to convert the following image to ASCII art

The output I want from a program should be similar to what was created from a screenshot of the output from an image-to-ASCII converter (the output was plain text).

I am aware that GIMP has the ability to save an image as ASCII graphic, and Aview can convert an image to ASCII as well. However, the former cannot be done from the command line, and the latter only allows you to view the output, not save it (I don't want to resort to a screenshot of the output).

I am also aware that libcaca can save its output in an image, but it only outputs colorful ASCII, like below.

Created by converting the source image to grayscale and then using the following command:

The reason I wanted a command line utility is to batch process a folder full of images.


I've never tried it before, but I know it's possible to forward text to (ImageMagick). If you set the output -f of img2txt to ansi (instead of colored ansi), you can forward the result to be converted (or another suitable software).


@horatio: convert seems to be awaiting file input and refuses to read from a pipe. We can do it through a temporary file anyway.


You can use this Python code I created to create ASCII graphics from still images and videos:


Sample output


ASCII art edition ()


Links come and go, even if it's your own site ... could you please add two screenshots of "before" and "after" with your code?


@Ilan I added an example and pointed it to a public git repository


If you're running Linux, you can simply put the applications together to get the result you want. This can then also be built into your batch script.

The following example uses jp2a, a powerful JPG-ASCII converter with many options to achieve the desired results (see man page). Then we process the resulting ASCII text file using the Conversion from the ImageMagick suite to an image. Here, too, there are many ways to optimize the result. Both applications are likely available in your distribution's repositories.

The following example script creates an ASCII image from an entered JPEG image (format depends on the extension we specified, is for JPEG). The source is rendered to a width of 160 characters at 6 pt. This then simply fits to the standard page size as it was predefined during the conversion.


This is probably the next point I can get to my desired output. Many Thanks!


@awashburn: The image size is determined by the character number (width) and the point size. Increase the point size for larger output or scale the resulting image in a second pass.


For macOS users: jp2a is also available through homebrew and runs:.

の b る し tt ぱ ん ん k

In some cases also a direct output in HTML in:. You can specify your preferred one for rendering (you need to mask metacharacters if you want to use them). For jp2a see also AUR for Arch .


In Node.js Knockout 2012 there was a successful submission that took a webcam video feed and spat out an "ASCII feed":


Asciigram is a "productivity tool" that allows you to use your webcam to create ASCII videos and images. You can also create ASCII images by dragging images onto the page. [Shortcut]

It's not exactly the command line, but maybe you can upgrade it for your needs. The library that the image in ASCII is converted is called Jscii .


Only text and no images are output. In addition, it is not a command line tool


I use jp2a for ASCII art. Easy to use from the command line:

And can test results online at asciiconvert.com.


jp2a is already listed and your link doesn't add anything at all (it won't open).


You seem to be using Linux and already know about libcaca. There is another library that does exactly what you say (Image to Ascii on the command line): Aalib.

There are many programs that do this. This works on both Linux and Windows. Does not use external libraries, full source code, etc.


As far as I know, Aalib cannot save its output directly to an image - it would have to use a screenshot method that would not be reliable for large images. If there is a way to do this with Aalib, can you update your answer? The program you mentioned looks really nice. Does it do a batch conversion and is there a command line interface for it?