Skip to main content

Convert images and video to ASCII art

Project description

asciiify

Python library and CLI for converting images and videos to ASCII art. Powered by Rust via PyO3.

Part of the asciiify project.

Pikachu

Install

pip install asciiify

Building from Source

Requires Rust and maturin.

git clone https://github.com/tomerramk/asciiify.git
cd asciiify/crates/asciiify-py

pip install maturin

# Build and install into the active Python environment
maturin develop --release

# Or build a wheel and install it
maturin build --release
pip install ../../target/wheels/asciiify-*.whl

CLI

Installing the package also provides the asciiify command:

# Convert an image
asciiify image.png

# Braille mode, custom width
asciiify image.jpg -m braille -w 100

# Output to file
asciiify image.png -o output.txt

# Play a video
asciiify video.mp4

# Play a video at a specific FPS
asciiify video.mp4 --fps 30

# All options
asciiify --help

Or via python -m:

python -m asciiify image.png -m half-block -w 80

Library Usage

import asciiify

# Convert image file
art = asciiify.convert("image.png")
print(art)

# With options
art = asciiify.convert("image.jpg", mode="braille", width=100, height=50)

# Convert from bytes
with open("image.png", "rb") as f:
    data = f.read()
art = asciiify.convert_bytes(data, mode="half-block", width=80)

# Reusable converter
converter = asciiify.Converter(mode="ascii", width=120, invert=True)
art = converter.convert("image.png")

# Video: iterate frames as ASCII strings
from asciiify import VideoFrames

frames = VideoFrames("video.mp4", width=80)
print(f"FPS: {frames.fps}")
for frame in frames:
    print(frame)

Video Support

Video support is included by default. FFmpeg is downloaded automatically on first use.

from asciiify import VideoFrames

frames = VideoFrames("video.mp4", width=80)
print(f"FPS: {frames.fps}")
for frame in frames:
    print(frame)

Build note: when building from source, video is included in the default build:

maturin develop

Output Modes

Mode Description
"ascii" Classic character ramp (default)
"half-block" Unicode blocks, 2x vertical resolution
"braille" Unicode braille, 4x vertical resolution

API

convert(path, *, mode="ascii", width=None, height=None, invert=False, charset=None) -> str

Convert an image file to ASCII art.

convert_bytes(data, *, mode="ascii", width=None, height=None, invert=False, charset=None) -> str

Convert in-memory image bytes to ASCII art.

Converter(*, mode="ascii", width=None, height=None, invert=False, charset=None)

Reusable converter with preset options. Has .convert(path) and .convert_bytes(data) methods.

License

MIT

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

asciiify-0.3.0.tar.gz (30.9 kB view details)

Uploaded Source

Built Distributions

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

asciiify-0.3.0-cp39-abi3-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

asciiify-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

asciiify-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

asciiify-0.3.0-cp39-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

asciiify-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file asciiify-0.3.0.tar.gz.

File metadata

  • Download URL: asciiify-0.3.0.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for asciiify-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1d971b269ab94309c1a8b04ddc34a443e3d91b15c05f70eb27657bb3053eef82
MD5 45e5294af3685553892fc5180526a642
BLAKE2b-256 a0c635771a79887d9f8cf603975905f214febc2cf6cf5581aa2dd72e9bb9a562

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0.tar.gz:

Publisher: release.yml on tomerramk/asciiify

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

File details

Details for the file asciiify-0.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: asciiify-0.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for asciiify-0.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ba8e39530bcea5b469c2b0b08930211d91c8b624ed80f2b43a46821e7d94cc83
MD5 77986f984392e7a9308126a648eddd2b
BLAKE2b-256 5d35c3b76a85cec93b574b8b4e5cf2ac3473e3c4a91c5ec17950ff97a3203cda

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on tomerramk/asciiify

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

File details

Details for the file asciiify-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for asciiify-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fe117cb392c067f66a6e5bc7a14532d18dfdf7cee72aef97fdf1ba689baa44a5
MD5 4477d153ca154543a7cb371a73adc2be
BLAKE2b-256 823e50fb4f29806ae48aad1d350a0c6e9b149500cade14a2c275ef25d1de02ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tomerramk/asciiify

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

File details

Details for the file asciiify-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asciiify-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf0b061b9466a98253df4d51fed09855f509b1d459994fc13fe6a16d86c27598
MD5 184e6d4a50d7d2e0521b9d7c9d8f6bb9
BLAKE2b-256 4dd3f050c29fc42bc520a7ad28d2a216d2225b0e0857ea761a3c85c197a5693f

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on tomerramk/asciiify

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

File details

Details for the file asciiify-0.3.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asciiify-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3649d8439e98e39b8d076f251c98562d50b3f661946a47e0b677910a73dac5e3
MD5 e2e641bbd3ac45b38f26808150770bb7
BLAKE2b-256 82e142e5fafab24885292def4a41a4ce497c7bb4f92d3790eed056765e5badbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on tomerramk/asciiify

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

File details

Details for the file asciiify-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asciiify-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fff2c179fcdc398d8699aa3365c2f14e09d04fb255456eec40ad9af033460c37
MD5 100f84bd8fba0df3bcbcd0f8faeb362f
BLAKE2b-256 6bb758b5f7a00cfeedb487fd8f784a95efdaa96f16e0a10be51cc3c315d1687c

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on tomerramk/asciiify

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