ztext turns a PNG into ASCII, back into a PNG.
  • Python 91%
  • Shell 9%
Find a file
2026-07-05 16:13:10 +00:00
.gitignore add fixes and examples 2026-07-04 15:33:50 +00:00
.python-version initialize project 2026-07-04 15:16:32 +00:00
AGENTS.md add license and vibe guidelines 2026-07-04 15:43:57 +00:00
example.sh add fixes and examples 2026-07-04 15:33:50 +00:00
LICENSE add license and vibe guidelines 2026-07-04 15:43:57 +00:00
pyproject.toml initialize project 2026-07-04 15:16:32 +00:00
README.md add fixes and examples 2026-07-04 15:33:50 +00:00
uv.lock initialize project 2026-07-04 15:16:32 +00:00
ztext initialize project 2026-07-04 15:16:32 +00:00
ztext.py fix enum names 2026-07-05 16:13:10 +00:00

ztext

The "z" stands for Seth.

Description

This project is a ASCII art tool. Point it at a PNG, and it'll convert that PNG into ASCII. Then it converts the ASCII back into a PNG, because massive text files are a bit unwieldy.

Known Issues

  • Scaling down your image is likely going to be necessary. When dealing with extremely large files, an unusable file is produced

Use

Here's a Bash script that implements ztext.

#!/usr/bin/env bash
# ./example.sh

color= background= scale= gradient= luminance= sampling=
while getopts "c:b:s:S:g:l:h" opt; do
    case $opt in
        c) color=$OPTARG ;;
        b) background=$OPTARG ;;
        s) scale=$OPTARG ;;
        S) sampling=$OPTARG ;;
        g) gradient=$OPTARG ;;
        l) luminance=$OPTARG ;;
       \?) continue
    esac
done
shift $((OPTIND - 1))
files=("$@")

for file in "${files[@]}"; do
    filename=${file##*/}
    stem=${filename%.*}
    suffix=${filename##*.}

    target="./out/$stem-$gradient-$color-$background-$luminance-$sampling.$suffix"
    ./ztext "$file" --target=$target --scale=$scale --sampling=$sampling \
        --gradient=$gradient --luminance=$luminance --color=$color \
        --background=$background
done

./example.sh -c green -b black -s 0.065 -S 1 -g profoak -l quadratic

TODO

  1. Full 1:1 color mapping
  2. Pixel Shaders abd animations
  3. GIF, MP4, and JPEG outputs
  4. SVG input