Convert images to beautiful ANSI escape codes
Slowing down. Last release over 2 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install climageCLImage 📷
Convert images to beautiful ANSI escape codes for display in command line interfaces.
Available as both a CLI application and a Python library.

Features
- Custom sized images
- ASCII or Unicode support
- Unicode enables 4x more detail
- 8/16/256/Truecolor support, for a wider gamut of colors
- Selectable system palettes to adjust for user terminal themes
- Fast color lookup with KDTrees & memoization
Usage
CLImage is available as both a standalone CLI program, or available for import as a Python3 library.
CLI Program
By default converting an image will output in 256 color, as 80 columns, and ASCII (for reasonable compatibility).
$ climage image.png

A nicer image can be obtained when enabling unicode and truecolor flags.
$ climage --unicode --truecolour image.png

For display in TTYs such as the Linux terminal before starting X11 (also accessible by Ctrl-Alt-F3, etc), you should restrict yourself to 8 color, and ASCII only. As 8 and 16 colors are solely constructed out of system colors (often set by the terminal theme), it is recommended to select a palette for these, depending on what you have selected.
$ climage --8color warhol.png --palette solarized

Further options may be found by running climage --help
Python Library
It is recommended that you use the Python library if converting a large number of images. Simple usage:
import climage
# Convert an image to a 50 character wide image.
output = climage.convert('image.png', is_unicode=True, width=50)
print(output)
# Convert an image using 8 color mode 100 columns wide, and write to file.
climage.to_file('image.png', 'out.txt', is_8color=True, width=100)
Formats
The API also supports supplying a Pillow Image object, or a array representing an image.


