Skip to main content

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

![Original](alt text)

Converted ASCII Art (screenshot)

![ASCII_Art](alt text)


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 (Pillow only)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

letter_art-0.2.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

letter_art-0.2.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file letter_art-0.2.2.tar.gz.

File metadata

  • Download URL: letter_art-0.2.2.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

Hashes for letter_art-0.2.2.tar.gz
Algorithm Hash digest
SHA256 cb45c9a0d641f765e4e003c853172023737abdc263e73ea81ed51c4671f8ddfc
MD5 e49f04f07851847007fc614027037c70
BLAKE2b-256 27667e4aa0e4714bfae050c63734913dd0b3510e8b944245c097be9de1e049af

See more details on using hashes here.

Provenance

The following attestation bundles were made for letter_art-0.2.2.tar.gz:

Publisher: python-publish.yml on gwondoo/letter_art

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file letter_art-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: letter_art-0.2.2-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

Hashes for letter_art-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3d95ca2123538239e52b02f5eacd1a83d9357a8b1dc8f26145c7c80923aea536
MD5 4a7aaab3218a59807189dfdc0b1b1a96
BLAKE2b-256 85f21c7de2801187a6fe9c7688fa9cd542da921e92b3f4609a1af5c6ae6b2144

See more details on using hashes here.

Provenance

The following attestation bundles were made for letter_art-0.2.2-py3-none-any.whl:

Publisher: python-publish.yml on gwondoo/letter_art

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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