Skip to main content

Convert images to beautiful ANSI escape codes

Project description

CLImage

Convert images to beautiful ANSI escape codes for display in command line interfaces.

Available as both a CLI application and a Python library.

demo

Features

  • 8/16/256/Truecolor supports
  • Custom system color palettes
  • Toggleable Unicode mode, allowing up to 4x more detail
  • Custom output size

Example usage

CLI

$ climage --unicode --truecolor --cols 80 barney.jpg

cliusage

For more detail and available options, run $ climage --help.

Python

import climage

output = climage.convert('image.png', is_unicode=True)
print(output)

# Converting downloaded file
from PIL import Image
import requests
response = requests.get('https://www.python.org/static/community_logos/python-logo-master-v3-TM-flattened.png')
# Convert to RGB, as files on the Internet may be greyscale, which are not
# supported.
img = Image.open(BytesIO(response.content)).convert('RGB')
# Convert the image to 80col, in 256 color mode, using unicode for higher def.
converted = climage.convert_pil(img, is_unicode=True)
print(converted)

# Convert the image into 50px * 50px, as the convert_array function does not
# perform resizing.
img = Image.open('image.png').convert('RGB').resize((50, 50))
arr = np.array(img)
output = climage.convert_array(arr, is_unicode=True)
print(output)

View additional examples on the project homepage.

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

climage-0.2.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

climage-0.2.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file climage-0.2.0.tar.gz.

File metadata

  • Download URL: climage-0.2.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for climage-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9cb97697279294faeacd5fcfd38c84ca29a53daf8fb6aca49f59b024cb0c2c08
MD5 c88c2177d351f3cdf47466566b394ad3
BLAKE2b-256 315f6fda48d2f9d7f93f4163303bd1c1838a656022020d379e89df6958149385

See more details on using hashes here.

File details

Details for the file climage-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: climage-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for climage-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d335945069cff77b92697e2a3d2e1e034e489f94d7a5d3b41745900352b6c3c
MD5 be9d2c1a9415ad1e0598205c2a094c44
BLAKE2b-256 20cd88de7bf9acd20fabb451c92142493ada91a3bd3a6e9742f72534baea075a

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