1 #!/bin/bash 2 3 FILE=$1 4 RES=`identify -verbose "${FILE}" | grep '^ *Geometry:' | cut -f 2 -d : | sed s/' '//g` 5 if [ "${RES}" = "480x240" ]; then 6 BASEDIR=`echo "${FILE}" | sed s/'[^/]*$'/''/g ` 7 BASEFILE=`echo "${FILE}" | sed s/'^.*\/'/''/` 8 if [ -z "${BASEDIR}" ]; then BASEDIR="./"; fi 9 BAKDIR="${BASEDIR}/.old/" 10 BAKFILE="${BAKDIR}/${BASEFILE}" 11 if [ -f "${BAKFILE}" ]; then 12 echo "${BAKFILE} already exists, doing NOTHING" >&2 13 exit 1 14 fi 15 if [ -f "${BAKDIR}" ]; then 16 echo "ERROR! ${BAKDIR} is a file! Sleeping forever." >&2 17 sleep 600000 18 exit 1 19 fi 20 mkdir "${BAKDIR}" 2>/dev/null 21 ln -s ../index.ttml "${BAKDIR}" 2>/dev/null 22 mv "${FILE}" "${BAKFILE}" 23 convert -sample '100%x150%' -antialias "${BAKFILE}" "${FILE}" 24 exit 0 25 else 26 exit 1 27 fi fixoldimages.sh is a short script to correct the aspect ration on some images I have. |