CLImage
raw JSON → 0.2.2 verified Fri May 01 auth: no python maintenance
CLImage is a Python library for converting images into ANSI escape code strings, enabling terminal image display using TrueColor, 256-color, or monochrome palettes. Current version 0.2.2, updated to support Python >=3.2. Releases are infrequent.
pip install climage Common errors
error AttributeError: module 'climage' has no attribute 'convert' ↓
cause Using `import climage` and then calling `climage.convert()` - the function must be imported explicitly.
fix
Use
from climage import convert or access climage.climage.convert after import. error AttributeError: 'str' object has no attribute 'size' ↓
cause Passing a file path string directly to `convert` instead of a PIL Image object.
fix
Open the image first:
from PIL import Image; img = Image.open('path.png') then pass img. error ValueError: unknown image format ↓
cause Attempting to convert an unsupported image format (e.g., WebP, SVG).
fix
Convert the image to PNG or JPEG before processing, e.g., using Pillow's convert.
Warnings
gotcha The `convert` function expects a PIL Image object, not a file path. Passing a string will cause AttributeError. ↓
fix Always open the image with Image.open() before passing to convert.
gotcha TrueColor output may not render correctly on terminals that do not support 24-bit color. Use is_truecolor=False or is_256color=True for compatibility. ↓
fix Set is_truecolor=False and is_256color=True for broader terminal support.
gotcha The library currently only supports PNG, JPEG, and BMP formats via Pillow. Other formats may raise UnidentifiedImageError. ↓
fix Convert image to a supported format before using climage.
Imports
- convert wrong
import climage; climage.convert()correctfrom climage import convert
Quickstart
from climage import convert
from PIL import Image
img = Image.open('example.png')
output = convert(img, is_unicode=True, is_truecolor=True, is_256color=False)
print(output)