animation/arbitrary.sh

29 lines
712 B
Bash
Raw Normal View History

#!/bin/bash
SKETCH=$(realpath "${1}")
IMAGES=$(realpath "${2}")
SVG=$(realpath "${3}")
FILES=$(mktemp)
ls -1 "${IMAGES}" > "${FILES}"
cd "${SKETCH}"
while read image; do
echo "Processing ${image}..."
name=$(basename "${image}")
name=${name%.*}
cp "${IMAGES}/${image}" "${SKETCH}/pos.png"
#convert "${SKETCH}/pos.png" -negate "${SKETCH}/negative.png"
bash ~/src/animation/white.sh "${SKETCH}/pos.png" "${SKETCH}/image.png"
timeout 10s processing-java --sketch="${SKETCH}" --run
#svgsort "./dithered.svg" --dim=107x99 "./fixed.svg"
svgo -i "./dithered.svg" -o "./fixed.svg"
cp "./fixed.svg" "${SVG}/${name}.svg"
rm "${SKETCH}/dithered.svg"
echo "Created ${SVG}/${name}.svg"
done < "${FILES}"
#