From 727713f41b7a663593ecd0b113efd99b9187e5cd Mon Sep 17 00:00:00 2001 From: mattmcw Date: Mon, 2 Jan 2023 12:21:40 -0500 Subject: [PATCH] All work on aktinson dithering-related scripts --- arbitrary.sh | 28 ++++++++++++++++++++++++++++ seq.sh | 4 ++-- white_quarter.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 arbitrary.sh create mode 100644 white_quarter.sh diff --git a/arbitrary.sh b/arbitrary.sh new file mode 100644 index 0000000..05c6aae --- /dev/null +++ b/arbitrary.sh @@ -0,0 +1,28 @@ +#!/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}" +# diff --git a/seq.sh b/seq.sh index 54901da..06bd69c 100644 --- a/seq.sh +++ b/seq.sh @@ -18,8 +18,8 @@ INVERT="${3}" START_FRAME=${4} END_FRAME=${5} -WIDTH=323 -HEIGHT=242 +WIDTH=323 #80 +HEIGHT=242 #60 if [[ "${INVERT}" != "" ]] && [[ "${INVERT}" == "negative" ]]; then INVERT="negate," diff --git a/white_quarter.sh b/white_quarter.sh new file mode 100644 index 0000000..33b7d53 --- /dev/null +++ b/white_quarter.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +########################### +# +# Centers an image in a white frame. +# Used for creating SVG files with a +# "natural" offset. +# +########################### + +WIDTH=101 #404 +HEIGHT=93 #374 + +#40.5 +#66 + +#FWIDTH=323 +#FHEIGHT=242 + +#800x800 white in center of image +#convert image.jpg -background white -gravity center -extent 800x800 output.jpg + +convert -size ${WIDTH}x${HEIGHT} xc:#FFFFFF white.png +composite -gravity Center "${1}" white.png "${2}" +rm white.png + +echo "Centered in white ${1} -> ${2}" \ No newline at end of file