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.4.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.4.0-cp39-abi3-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

asciiify-0.4.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.4.0-cp39-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

asciiify-0.4.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.4.0.tar.gz.

File metadata

  • Download URL: asciiify-0.4.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.4.0.tar.gz
Algorithm Hash digest
SHA256 40ea0de184f9f4ee5ac1c25f3e02c445a302862ca2f63f3845cfc164fa11b6ea
MD5 df29bc9d438216b0a74ff6e9cbf8b378
BLAKE2b-256 e0ab085c48bb89613366699aeb3cf839254ad771897b0c31fc43cb9f5f3d51ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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.4.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: asciiify-0.4.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.4.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e2659a6e2ee843b1a8393937ab8de9e9719430acb8a3268bd13e879ecf1dea88
MD5 68df017a57ae6cc24ba2f0b7beb90744
BLAKE2b-256 12015f37def59677261694ec2e758365cb5baed4f012526fe958d94b5aae6ffa

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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.4.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for asciiify-0.4.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a2b427cb4f46e1fcd1edfd8af61476ff84e1f8521c3533d8ee55e1d3ddf1e271
MD5 10d101e2f4f0bbe0ab6c7e83ef607a32
BLAKE2b-256 f21388116726f88907c89ef66903f16cd1766d47e2a0ccd8a970697855225b38

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asciiify-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc9b359b5d0c2957e5d3ff2d144f0a08d71aba92e6995ded4e1c39466d2f260e
MD5 aa04e6d65871bc2eb1ba6d91a4682f24
BLAKE2b-256 f7461a85189ced1ff1c26533a20c5f7d4f780f08d9e1add6e14e35ddc6600b05

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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.4.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asciiify-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1ee0b401839ab7180165102465e02869323b25b8e3c66b41db8c79597697cef
MD5 7ce353fa06313fc1791ca77c7daebcbb
BLAKE2b-256 bd0a989cca4bd2b38bb854dc81e59f7676b80bf984e347dabbb5b680e7ae9bee

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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.4.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asciiify-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d591eab4e0b414df415d8cfba573c4b3fb89a4c444df3b0f28e74111861d3b58
MD5 3a0a9f7918a9dbd2a343e25e07bc9923
BLAKE2b-256 3a94980ea761d8bc9cf8328b2d398644b4e314e56f790f489642754f5ea4a3f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for asciiify-0.4.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