ASCII Art Library
A Python library for generating ASCII art from images with advanced filtering capabilities.
Features
- Generate high-quality ASCII art from images
- Sprite-based character rendering for better visual results
- Edge detection using Difference of Gaussians (DoG) filtering
- Configurable character sets and rendering parameters
- Both programmatic API and command-line interface
Installation
pip install -e .
Usage
Command Line Interface
Generate ASCII art from an image:
ascii-art input.jpg -o output.png
Customize edge detection sensitivity:
ascii-art input.jpg --edge-threshold 70 -o output.png
Disable edge detection:
ascii-art input.jpg --no-edge -o output.png
Programmatic API
from ascii_art import SpriteASCIIGenerator
import cv2
# Create generator with default settings (edge detection enabled)
generator = SpriteASCIIGenerator()
# Load and process an image
img = cv2.imread("input.jpg")
ascii_img = generator.generate_ascii(img)
# Save result
cv2.imwrite("output.png", ascii_img)
Customize settings:
from ascii_art import SpriteASCIIGenerator
import cv2
# Create generator with custom settings
settings = {
"use_edge": True, # Enable edge detection (default: True)
"edge_threshold": 70, # Edge detection sensitivity (default: 90)
"font_size": 8, # Font size for characters (default: 8)
"sharpness": 5, # Image sharpness (default: 100)
"white_point": 128 # White point threshold (default: 2)
}
generator = SpriteASCIIGenerator(settings)
# Load and process an image
img = cv2.imread("input.jpg")
ascii_img = generator.generate_ascii(img)
# Save result
cv2.imwrite("output.png", ascii_img)
Configuration
You can customize the ASCII art generation by passing settings to the generator:
settings = {
"use_edge": True, # Enable edge detection
"edge_threshold": 90, # Edge detection threshold
"font_size": 8, # Font size for characters
"sharpness": 5, # Image sharpness
"white_point": 128 # White point threshold
}
generator = SpriteASCIIGenerator(settings)
API Reference
SpriteASCIIGenerator
Main class for generating ASCII art using sprite-based approach.
Methods
__init__(settings): Initialize the generator with settingsgenerate_ascii(img): Generate ASCII art from an image
DoGFilter
Difference of Gaussians filter for edge detection.
Methods
__init__(settings): Initialize the filter with settingsdifference_of_gaussian(image): Apply DoG filter to an imageflow_dog(image): Apply flow-based DoG filtering
Requirements
- Python 3.11+
- OpenCV
- NumPy
- Pillow
- SciPy
License
MIT
Metadata
Release files for adhipk-ascii-art 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adhipk_ascii_art-0.1.0.tar.gz | 10.1 kB | Without provenance | Details for adhipk_ascii_art-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adhipk_ascii_art-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for adhipk_ascii_art-0.1.0-py3-none-any.whl |
Total release size: 22.6 kB
Release files / adhipk_ascii_art-0.1.0.tar.gz
| Download URL | adhipk_ascii_art-0.1.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7584977d26b8d34e12ee8afe9b6bab555a150c43d87e55339dacb4506d41332d
|
|
BLAKE2b-256 checksum How to use checksums |
c9fb64afda52dbeb65a94e13c5865fcc03536bbe53274e16e8837b96b43c2d4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Release files / adhipk_ascii_art-0.1.0-py3-none-any.whl
| Download URL | adhipk_ascii_art-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b9a74334778bb7d3ecaa83dd2025aac02055b74a874ae28090f2eee5ccd3419
|
|
BLAKE2b-256 checksum How to use checksums |
299d8f67586651f34ccfd2886e8c83b366c2291a1ad2b3f9ae6d23a8ec5dfe8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Security for adhipk-ascii-art 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.