Skip to main content

Simple Python package to display an image in the terminal by converting it into text

Project description

Image In Terminal

Simple Python package to display an image in the terminal by converting it into text. For the desired behavior to be achieved, the terminal must support colors and there should be no spacing between lines (0 line-spacing).

Installation

pip install image-in-terminal

How to use

You can use the package either from the terminal or from a script.

imageinterminal -h

usage:
  imageinterminal image_uris [options]

positional arguments:
  image_uris            File path(s) or HTTP/HTTPS link(s) of the image(s) to be displayed. A directory can also be
                        passed in which case all supported images in the directory will be displayed.

options:
  -h, --help            show this help message and exit
  -w WIDTH, --width WIDTH
                        Destination width of the image(s).
  -wt WHITENESS_THRESHOLD, --whiteness-threshold WHITENESS_THRESHOLD
                        (float [0 - 1]). Pixels with a whiteness higher than this value will be inverted.
  -dt DARKNESS_THRESHOLD, --darkness-threshold DARKNESS_THRESHOLD
                        (float [0 - 1]). Pixels with a whiteness lower than this value will be inverted.
  -r, --recursive       If a directory is passed as image_uri the image search will be recursively performed within
                        the directory passed and all its subdirectories.

From the terminal:

imageinterminal "myImage.jpg"
imageinterminal "https://images/exampleImage.jpg" "myOtherImage.png" -w 128
imageinterminal "myImagesOnWhiteBackgrounds" -w 256 -wt 0.97 

From a python script:

from imageinterminal import display_image
display_image("myImage.jpg")

Screenshots

JPG 256x256




PNG 128x128




PNG 256x256




Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image-in-terminal-1.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

image_in_terminal-1.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file image-in-terminal-1.1.0.tar.gz.

File metadata

  • Download URL: image-in-terminal-1.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for image-in-terminal-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7c5fefea740a859cc279363f7cb5ba07b5c648ca4cc76bb49cc02944b15a3b70
MD5 40388d94d3fcb211258c510e19ec1a0d
BLAKE2b-256 0b1408f56bb63fcec145389d92fd5c97041533a7c9ed2d814c48faa9e995562e

See more details on using hashes here.

File details

Details for the file image_in_terminal-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for image_in_terminal-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8939b8484aa3655f74527df4018e2acc8acdb880180e1fee6a781a76cbe863d7
MD5 bc790509935318a33096d5bc77caa025
BLAKE2b-256 ad5c46f76f191d9feef06c1e86249600f8204ea865677626e820e81a3a26cda1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page