Skip to main content

Display images in the terminal

Project description

This project is a branch of term-image on QPython.

Quick Start

Creating an instance

  1. Initialize with a file path:

    from term_image.image import from_file
    
    image = from_file("path/to/image.png")
    
  2. Initialize with a URL:

    from term_image.image import from_url
    
    image = from_url("https://www.example.com/image.png")
    
  3. Initialize with a PIL (Pillow) image instance:

    from PIL import Image
    from term_image.image import AutoImage
    
    img = Image.open("path/to/image.png")
    image = AutoImage(img)
    

Drawing/Displaying an Image

There are two basic ways to draw an image to the terminal screen:

  1. Using the draw() method:

    image.draw()
    

    NOTE: draw() has various parameters for render formatting.

  2. Using print() with an image render output:

    print(image)  # without formatting
    # OR
    print(f"{image:>200.^100#ffffff}")  # with formatting
    

For animated images, only the former animates the output, the latter only draws the current frame.

See the tutorial for a more detailed introduction.

Usage

🚧 Under Construction - There will most likely be incompatible changes between minor versions of version zero!

If you want to use this library in a project while it's still on version zero, ensure you pin the dependency to a specific minor version e.g >=0.4,<0.5.

See the docs for the User Guide and API Reference.

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

term_image_qpython-0.7.2.1.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

term_image_qpython-0.7.2.1-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

Details for the file term_image_qpython-0.7.2.1.tar.gz.

File metadata

  • Download URL: term_image_qpython-0.7.2.1.tar.gz
  • Upload date:
  • Size: 55.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for term_image_qpython-0.7.2.1.tar.gz
Algorithm Hash digest
SHA256 de8524c3b4cc822eb5ee0e84c9c4a58a1e5418f5c237a7067ca4b90291294d45
MD5 abb1235b7f3f394864da745bab1ba1c5
BLAKE2b-256 5c12afe4985fab322b3cb746cb5be6b5f52669a17a6547a30870f41f037eec3c

See more details on using hashes here.

File details

Details for the file term_image_qpython-0.7.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for term_image_qpython-0.7.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c10059115e2a4a22080ccb5b02868722e404aad205c6833bfa13dfb1005ef7e4
MD5 c3058ef17694a21bd80496b191a2e3f3
BLAKE2b-256 b5f7a067b225fc057ddcd60843f8b5d389907cdf4f5b82d01a10120f826d9f0d

See more details on using hashes here.

Supported by

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