diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..8226afb --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +external-sources=true diff --git a/opt.sh b/opt.sh index 133512c..7b7d70f 100644 --- a/opt.sh +++ b/opt.sh @@ -1,4 +1,6 @@ -source ./common.sh +#!/bin/bash + +source "./common.sh" if [[ "${1}" == "" ]]; then echo "Please provide a directory as the first argument" diff --git a/stipple.sh b/stipple.sh index 581bd45..9f4952e 100644 --- a/stipple.sh +++ b/stipple.sh @@ -16,6 +16,7 @@ fi INPUT=`realpath "${1}"` OUTPUT=`realpath "${2}"` INVERT="${3}" +SINGLE="${4}" if [ ! -d "${INPUT}" ]; then echo "Directory ${1} doesn't exist" @@ -41,19 +42,16 @@ fi IMAGES="" -#files in dir -for png in "${INPUT}/"*.png ; do +stipple () { + png="${1}" 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/ - if [ "${IMAGES}" == "" ]; then - part=`echo "${name}" | awk -F'_0' '{print $1}'` - IMAGES="${OUTPUT}/${part}_%06d_rendered.png" - VIDEO="${OUTPUT}/${part}.mov" - fi bash stipple_gen.sh \ --display "false" \ --inputImage "${tmp}" \ @@ -84,8 +82,21 @@ for png in "${INPUT}/"*.png ; do svgsort "${OUTPUT}/${name}.svg" "${opt}" mv "${opt}" "${OUTPUT}/${name}.svg" fi +} + +i=0; +#files in dir +for png in "${INPUT}/"*.png ; do + stipple "${png}" + i=$((i+1)) done +if [[ "${IMAGES}" == "" ]]; then + part=`echo "${name}" | awk -F'_0' '{print $1}'` + IMAGES="${OUTPUT}/${part}_%06d_rendered.png" + VIDEO="${OUTPUT}/${part}.mov" +fi + ffmpeg -y -r ${FRAMERATE} -f image2 -i "${IMAGES}" \ -c:v prores_ks -profile:v 3 \ "${VIDEO}"