- Shell 51.9%
- Python 48.1%
| Arch-logo | ||
| results | ||
| ansi2dur.py | ||
| LICENSE | ||
| png2dur.sh | ||
| README.md | ||
| README.ru.md | ||
Create Durdraw .dur for Ly
.dur — Durdraw ANSI/ASCII animation format
Used: Durdraw format v7
Tools
| File | Purpose |
|---|---|
png2dur.sh |
Bash pipeline: PNG frames → ANSI → .dur (calls ansi2dur.py) |
ansi2dur.py |
Python converter: ANSI/text frame sequence → Durdraw v7 .dur file |
png2dur.sh dependencies
- jp2a — converts JPEG/PNG to ASCII
fbsetor/sys/class/graphics/fb0— for screen resolution detection
You can start at any step in the chain: VIDEO → PNG → ANSI → DUR
VIDEO → PNG
ffmpeg -i video.mkv images/frame_%03d.png
Black background removal:
for img in images/*.png; do
filename=$(basename "$img")
magick "$img" \
-alpha set \
-fuzz 30% -transparent black \
-channel alpha -threshold 25% +channel \
-background black -alpha remove \
"images_without_background/$filename"
done
PNG
⚠️ Important: Source images (PNG) must be the size of your monitor (e.g., 1920×1080 or 2560×1080).
The--sizeoption in jp2a sets the output size in characters and ignores the aspect ratio of the source image.
If the source is smaller/larger than the target resolution — the image will be distorted (stretched/compressed).
PNG → ANSI → DUR
Method 1: Auto-detection (recommended)
# 1. Switch to TTY (not in terminal!)
Ctrl+Alt+F3
# 2. Log in
login: youruser
password: *****
# 3. Run the script
cd /path/to/your/project
./png2dur.sh -i arch_logo_1920_1080 -o results/arch_logo.dur
# 4. Expected result:
# Detected TTY size: 160 columns × 49 rows
# Generating with --size=160x49
Method 2: Resolution + Font Auto-Detection
./png2dur.sh \
-i arch_logo_1920_1080 \
-s 1920x1080 \
--fps 20 \
-o arch_logo.dur
If -s is specified but --font-w/--font-h are not, the script reads FONT
from /etc/vconsole.conf and tries to detect the font size from its name.
The --fps option sets the .dur playback framerate; if omitted,
ansi2dur.py uses the default value 8.
For --no-colors, you can explicitly set the text and background colors with
--fg and --bg, for example --fg 7 --bg 0.
This changes the .dur color scheme, but it does not significantly reduce Ly RAM
usage: the format still contains a colorMap for every frame, and Ly loads it fully.
Obvious font names with WxH size are supported, for example:
default8x16->8x16sun12x22->12x22solar24x32->24x32default->8x16
Method 3: Manual input
If you are in a graphical terminal, specify the screen resolution and font size manually:
./png2dur.sh \
-i arch_logo_1920_1080 \
-s 1920x1080 \
--font-w 12 --font-h 22 \
--fps 20 \
--no-colors --fg 7 --bg 0 \
-o arch_logo.dur
./png2dur.sh \
-i arch_logo_2560_1080 \
-s 2560x1080 \
--font-w 8 --font-h 16 \
-o arch_logo.dur