You can display an image in terminal. Using Python you can use the module timg
.
Setup
timg is available as a package on PyPI. You can install it with pip:
$ pip install timg
Now you can use the timg command in your terminal.
usage
To display an image from code:
import timg
obj = timg.Renderer()
obj.load_image_from_file("test.png")
obj.resize(100,40)
obj.render(timg.ASCIIMethod)
That turns the image into ascii art.
To run it as command line program:
usage: timg [-h] [-V] [-i] [-m METHOD] [-r N] [-s W] [filename]
print an image in terminal
positional arguments:
filename filename of an image
optional arguments:
-h, --help show this help message and exit
-V, --version print version and exit
-i, --invert-background
invert grayscale in ASCII mode
-m METHOD, --method METHOD
name of a rendering method (use `-m list` to list
available methods, the default is a24h)
-r N, --reduce-colors N
reduce color palette of an input image (1-256)
-s W, --size W width of an image
Top comments (2)
how can i use this in a python program ???, (no asci art)
every time i load i get nothing code below ↓
Hate to bother but was also wondering how to run this example code you gave but without it applying any styles like ASCII to it.