Is there any sort of utility I can use to convert an image to ASCII and then print it in my terminal? I looked for one but couldn't seem to find any.
-
Note that there are some terminals that let you display an image without converting it to text. They just display an image. For example, the kitty terminal can do this. – Flimm Jul 07 '23 at 12:52
7 Answers
A program called cacaview allows you to do this.
It is interactive, allowing you to pan, zoom, and change display modes.

- 2,890
- 20
- 18
-
2`cacaview` opens a new window, it doesn't print out the image to the terminal, at least not in Ubuntu 21.10 – Flimm Nov 20 '21 at 18:55
-
Doesn't look like there's a command line option, but you can just execute clearing the DISPLAY environment variable to have it run in the current terminal: `DISPLAY= cacaview yourimage.jpg` – Stecman Nov 22 '21 at 01:59
-
Setting `DISPLAY=` does work, but it takes over the terminal screen, it doesn't print out to the terminal like `echo` would. – Flimm Nov 22 '21 at 07:19
-
See meduz's answer below - `img2txt` uses the same underlying code as `cacaview`, but prints to console like you're looking for – Stecman Nov 24 '21 at 03:13
more simply, you may use img2txt
from the caca library (cacaview
is an image browser and opens a new window, which is not what is asked here I guess);
For instance :
on macosx, you may use homebrew :
$ brew reinstall libcaca --with-imlib2
(imlib is used to convert from different formats)
-
The default Homebrew install for libcaca (that is, without passing `--with-imlib2`) doesn't seem to be able to open any files. – bonh Oct 15 '14 at 03:27
Chafa
I like to use chafa
.
chafa example.png
You can download Chafa from Chafa's website or from your favourite package manager, like APT:
sudo apt install chafa

- 136,138
- 45
- 251
- 267
A high quality fast standalone conversion utility (provided you have a 256 color terminal) is pxl
, available at https://github.com/ichinaski/pxl.

- 22,436
- 15
- 82
- 99

- 31
- 1
Here's a utility that does this (with source code):
http://www.codeproject.com/Articles/10949/ASCII-Art-Generator

- 16,930
- 5
- 50
- 83
Another alternative is to use the Ipython notebook: it is pretty good at doing what you ask for.
For bash: You have to prepend commands with a bang. For images: You may use the rich display system from ipython.
A screenshot of the result:
Complete answer in this post.

- 3,903
- 1
- 28
- 40