Introduction
Introduction Statistics Contact Development Disclaimer Help
gifs.sh - chess-puzzles - chess puzzle book generator
git clone git://git.codemadness.org/chess-puzzles
Log
Files
Refs
README
LICENSE
---
gifs.sh (966B)
---
1 #!/bin/sh
2 # create animated gifs for puzzle solutions.
3 # Dependencies: ffmpeg, ImageMagick, etc.
4
5 tmppal="$(mktemp '/tmp/palette_XXXXXXXX.png')"
6
7 n=1
8 while :; do
9 f="puzzles/${n}.svg"
10 test -f "$f" || break
11
12 tmpdir="$(mktemp -d '/tmp/puzzleanim_XXXXXXXX')"
13
14 # initial puzzle state also
15 dest="$tmpdir/0.png"
16 convert "$f" "$dest"
17
18 # solution
19 i=1
20 while :; do
21 f="puzzles/solutions/${n}_${i}.svg"
22 test -f "$f" || break
23
24 dest="$tmpdir/$i.png"
25 convert "$f" "$dest"
26 i=$((i+1))
27 done
28
29 # create video / animation.
30 out="puzzles/solutions/$n.gif"
31 rm -f "$out"
32
33 # generate palette for gif.
34 rm -f "$tmppal"
35 ffmpeg -loglevel error -stats -i "$tmpdir/%d.png"\
36 -vf palettegen "$tmppal"
37
38 # wait longer for last frame.
39 ffmpeg -loglevel error -stats -framerate 1\
40 -i "$tmpdir/%d.png" \
41 -i "$tmppal" \
42 -lavfi 'tpad=stop_mode=clone:stop_duration=4[v];[v]palet…
43 -map '[out]' \
44 "$out"
45
46 rm -rf "$tmpdir"
47 rm -f "$tmppal"
48
49 n=$((n + 1))
50 done
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.