-for seed in 0 1 2 3 4; do
- for card in $(seq 0 9); do
- x=$(((seed * 2 + card / 5) * w))
- y=$(((card % 5) * h))
- argz="$argz $(printf "%s/%02d%s.png" "$fold" "$((seed * 10 + card))" "$sfx") -geometry +${x}+${y} -composite "
- if [ $seed -eq 4 ]; then
- break
- fi
+EOF
+
+ if [ "$card_id" = "40" ]; then
+ fin_no=$(printf "%s/%s_src/cover${direction}.png" "$fold_in" "$deck" "$((seed * 10 + card))")
+ fin=$(printf "%s/%02d%s.png" "$fold_in" "$((seed * 10 + card))" "$direction")
+ if [ "$direction" == "" ]; then
+ cp "$fin_no" "$fin"
+ fi
+ else
+ fin_no=$(printf "%s/%02d.png" "$fold_in" "$((seed * 10 + card))")
+ fin=$(printf "%s/%02d%s.png" "$fold_in" "$((seed * 10 + card))" "$direction")
+ fi
+ if [ "$direction" == "" ]; then
+ :
+ elif [ "$direction" == "_ea" ]; then
+ convert -rotate 270 "$fin_no" "$fin"
+ elif [ "$direction" == "_we" ]; then
+ convert -rotate 90 "$fin_no" "$fin"
+ else
+ exit 1
+ fi
+
+ argz="$argz $fin -geometry +${x}+${y} -composite "
+ if [ $seed -eq 4 ]; then
+ break
+ fi
+ done