Skip to main content

Image to Half-block ANSI art with 256-color XTerm codes.

Project description

img2hbterm

Image to Half-block ANSI art with 256-color XTerm codes.

Installation

As a CLI app

pipx install img2hbterm

As a module

pip install img2hbterm

CLI Usage

Simply convert using

img2hbterm image.png

Flags:

  • --nearest -n uses nearest neighbor to resize the image. (useful if antialiasing makes the output look too blurry)
  • --true-color -t uses True Color instead of XTerm 256-color. (less term support)
  • --width <int> -s <int> set the width of the image. (default: 128)

Module usage

from img2hbterm import convert
from io import BytesIO

print( convert("path") )

# The path can be anything Pillow supports, so BytesIO works as well
print( convert(BytesIO(b"....")) )

# With all the default values included
print(
    convert(
        "path",
        nearest=False,
        true=False, # Not to be confused with the boolean True
        size=128
    )
)

# Works the same way the CLI does, I don't need to document the parameters again.

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

img2hbterm-1.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

img2hbterm-1.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file img2hbterm-1.0.1.tar.gz.

File metadata

  • Download URL: img2hbterm-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for img2hbterm-1.0.1.tar.gz
Algorithm Hash digest
SHA256 75ef9eb5a866c4235244078c6bfe1ea9345470d2d907f1205bf4d779bfd5c256
MD5 2bfb22ae94dbb1608816ef8f0baf092e
BLAKE2b-256 2dc341f1cc43c83365a5c9bd6a365ade302e25c3cf54ddb193cced2136b37185

See more details on using hashes here.

File details

Details for the file img2hbterm-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: img2hbterm-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for img2hbterm-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 940de597bea367f69ab75babfefe709010eb087ba5bb736eba50823f111db6ef
MD5 8e0089a3cb9c49473cc205f82f71f5d3
BLAKE2b-256 6e8430eeae33921abf8d830696da803c89952be947a0bbef658410b6f624d945

See more details on using hashes here.

Supported by

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