Convert images into ASCII art in Python
Project description
letter-art
Convert images into ASCII art with adjustable resolution and output format.
A simple and fun Python library to turn your images into terminal-ready retro text art.
Example
Original Image
Converted ASCII Art (screenshot)
Installation
pip install letter-art
Features
- Convert any image to ASCII text art
- Customizable width, height, and character aspect ratio
- Choose to print the result or save it as a .txt / .html file
- CLI (Command Line Interface) support
- Minimal dependencies (
Pillowonly)
Quick Start (in Python)
from letter_art.converter import convert_image_to_ascii
# Basic usage: print to terminal
convert_image_to_ascii("sample.jpg", width=100, height=50, output="print")
# Save to a file
convert_image_to_ascii(
image_path="sample.jpg",
width=120,
height=60,
output="file",
output_path="ascii_output.txt",
output_format="txt" # or "html"
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
image_path |
str |
(required) | Path to the input image |
width |
int |
100 |
Width of the ASCII art (in characters) |
height |
int |
calculated | Height (optional). Auto-calculated if not provided |
output |
str |
"print" |
"print" for terminal output, "file" to save |
output_path |
str |
auto-named | Path to output file if output="file" |
output_format |
str |
"txt" |
"txt" or "html" output format |
height_scale |
float |
0.6 |
Vertical scale adjustment for character aspect ratio |
CLI Usage
After installation, you can run it directly from the terminal using:
letter-art --image sample.jpg --width 150 --output file --format html
CLI Options
| Option | Description |
|---|---|
--image |
Input image path (required) |
--width |
Width in characters (default: 300) |
--height |
Optional height |
--output |
"print" or "file" |
--output_path |
File path to save output (optional) |
--format |
"txt" or "html" |
--scale |
Vertical scaling factor (default 0.6) |
Example CLI Output
$ letter-art --image test.jpg --width 200 --output file --format txt
✔ ASCII art saved to test.txt
Recommended Images
- High-contrast images
- Logos, icons, or face portraits
- Grayscale-friendly content
License
MIT License
(c) 2025 gwondoo
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 letter_art-0.2.1.tar.gz.
File metadata
- Download URL: letter_art-0.2.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf7c62f3096ba4bba01985a3aa380d0105c654acc33fa9fc9d014bfd300c1267
|
|
| MD5 |
9b210ee0c085cb511d6024ae32ce9a07
|
|
| BLAKE2b-256 |
c0bf20fffff42b156afff4affbcfb83a3a396da964b10eca24400887b078cf58
|
Provenance
The following attestation bundles were made for letter_art-0.2.1.tar.gz:
Publisher:
python-publish.yml on gwondoo/letter_art
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
letter_art-0.2.1.tar.gz -
Subject digest:
cf7c62f3096ba4bba01985a3aa380d0105c654acc33fa9fc9d014bfd300c1267 - Sigstore transparency entry: 220290712
- Sigstore integration time:
-
Permalink:
gwondoo/letter_art@c968e2002719130a02c4d93062aacc7a9b2000be -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gwondoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c968e2002719130a02c4d93062aacc7a9b2000be -
Trigger Event:
push
-
Statement type:
File details
Details for the file letter_art-0.2.1-py3-none-any.whl.
File metadata
- Download URL: letter_art-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f7df0b107e8688d39d094205b2151dfaaacc134f47cea0f70a5c509ec30128
|
|
| MD5 |
75bd2ffcf18806d83446e7853c2db508
|
|
| BLAKE2b-256 |
cf84de4afa28eca77e90bf488f51b8113eae50ef1767aa7cb797081d8fb8cf41
|
Provenance
The following attestation bundles were made for letter_art-0.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on gwondoo/letter_art
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
letter_art-0.2.1-py3-none-any.whl -
Subject digest:
c1f7df0b107e8688d39d094205b2151dfaaacc134f47cea0f70a5c509ec30128 - Sigstore transparency entry: 220290721
- Sigstore integration time:
-
Permalink:
gwondoo/letter_art@c968e2002719130a02c4d93062aacc7a9b2000be -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gwondoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c968e2002719130a02c4d93062aacc7a9b2000be -
Trigger Event:
push
-
Statement type: