animation/stipple.sh

44 lines
949 B
Bash

#!/bin/bash
INPUT=`realpath "${1}"`
OUTPUT=`realpath "${2}"`
WIDTH=404
HEIGHT=374
DOTSIZE=4
MAXGENERATIONS=25
MAXPARTICLES=500
MINDOTSIZE=0.8
LINE=0.8
FILL=true
#files in dir
for png in "${INPUT}/"*.png ; do
filename=`basename "${png}"`
name=`echo "${filename}" | cut -d'.' -f1`
num=`echo "${name}" | awk -F'_' '{print $(NF)}'`
tmp=`mktemp`.png
bash white.sh "${png}" "${tmp}"
cd ~/src/stipple_gen/
bash stipple_gen.sh \
--inputImage "${tmp}" \
--outputImage "${OUTPUT}/${name}_rendered.png" \
--outputSVG "${OUTPUT}/${name}.svg" \
--canvasWidth $WIDTH \
--canvasHeight $HEIGHT \
--dotSizeFactor $DOTSIZE \
--windowWidth $WIDTH \
--windowHeight $HEIGHT \
--maxGenerations $MAXGENERATIONS \
--minDotSize $MINDOTSIZE \
--line $LINE \
--fill $FILL \
--maxParticles $MAXPARTICLES
rm "${tmp}"
cd ~/src/animation/
opt=`mktemp`.svg
svgsort "${OUTPUT}/${name}.svg" "${opt}"
mv "${opt}" "${OUTPUT}/${name}.svg"
done