Convert images to ASCII art with color, dithering, and multiple character sets
Project description
Asciify
A command-line tool and Python library that converts images into high-quality ASCII art with optional color, dithering, and brightness/contrast controls.
Features
- Multiple Character Sets: Choose from simple, complex, braille blocks, or Unicode block elements
- Color Output: Full ANSI 256-color support for colored ASCII art
- Floyd-Steinberg Dithering: Optional dithering for improved detail representation
- Image Adjustments: Control brightness and contrast
- Flexible Sizing: Auto-fit to terminal width or specify custom dimensions
- Invert Mode: Swap light and dark for different backgrounds
Installation
From PyPI
pip install asciify-image
From Source
git clone https://github.com/visakhunnikrishnan/asciify.git
cd asciify
pip install -e .
Usage
Command Line
# Basic usage
asciify image.jpg
# Specify width
asciify image.jpg -W 80
# Use complex character set with color
asciify image.jpg -c complex --color
# Enable dithering with custom brightness
asciify image.jpg --dither -b 1.2
# Save output to file
asciify image.jpg -o output.txt
# High contrast black and white
asciify photo.png --contrast 1.5 --invert
# Braille art (requires Unicode-capable terminal)
asciify image.png -c blocks
Python Library
from asciify import ASCIIArtConverter
# Basic conversion
converter = ASCIIArtConverter()
ascii_art = converter.convert("image.jpg", width=80)
print(ascii_art)
# With options
converter = ASCIIArtConverter(
charset="complex",
colored=True,
dither=True,
)
ascii_art = converter.convert(
"image.jpg",
width=100,
brightness=1.2,
contrast=1.1,
invert=False,
)
# Convert PIL Image directly
from PIL import Image
img = Image.open("photo.png")
ascii_art = converter.convert_image(img, width=80)
Options
| Option | Description |
|---|---|
-W, --width |
Output width in characters |
-H, --height |
Output height in characters |
-c, --charset |
Character set: simple, complex, blocks, symbols |
--color |
Enable colored output |
--dither |
Enable Floyd-Steinberg dithering |
--invert |
Invert the image colors |
-b, --brightness |
Brightness adjustment (0.0-2.0, default: 1.0) |
--contrast |
Contrast adjustment (0.0-2.0, default: 1.0) |
-o, --output |
Save output to file |
Character Sets
- simple:
.:-=+*#%@- Basic ASCII characters - complex:
.",:;!~+-xmo*#W&8@- Extended ASCII for more detail - blocks: Braille patterns for high-density output
- symbols: Unicode block elements for solid fills
Development
Setup
git clone https://github.com/visakhunnikrishnan/asciify.git
cd asciify
pip install -e ".[dev]"
Running Tests
pytest
Code Quality
ruff check src tests
mypy src
Requirements
- Python 3.9+
- Pillow
- NumPy
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asciify_image-0.1.0.tar.gz.
File metadata
- Download URL: asciify_image-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7473b5acaae0b495263367d3e3f560574ce5fe2497924838ee84f53565301777
|
|
| MD5 |
0eccc0648c7550272fe1686dc40b5ae4
|
|
| BLAKE2b-256 |
fd0b1ac6b39881e6d4ddc45bf7deea775b16e130599dd7d0c38e5634bfb5489a
|
File details
Details for the file asciify_image-0.1.0-py3-none-any.whl.
File metadata
- Download URL: asciify_image-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5af4bbcd22bdccae637f5cee7f7ec4837e6a0db488330166a13cf7be53713258
|
|
| MD5 |
5a4c7f3950ef0ba08b498e41b251e401
|
|
| BLAKE2b-256 |
454afc5e5c3472643ecef6fe7532dc8b3be4c25605720b427e9a0522bfa4fc7b
|