ztext turns a PNG into ASCII, back into a PNG.
- Python 91%
- Shell 9%
| .gitignore | ||
| .python-version | ||
| AGENTS.md | ||
| example.sh | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
| ztext | ||
| ztext.py | ||
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
- Full 1:1 color mapping
- Pixel Shaders abd animations
- GIF, MP4, and JPEG outputs
- SVG input