Updated quality and fixed bug for file with spaces

This commit is contained in:
dbroqua 2018-05-25 22:23:04 +02:00
parent bb73a5ceae
commit 61ab1c8502

View file

@ -32,7 +32,7 @@ COVERFILE="cover.jpg"
COVERRATIO=$((${COVERWIDTH}/${COVERHEIGHT})) COVERRATIO=$((${COVERWIDTH}/${COVERHEIGHT}))
LOGO=~/template/logo.png LOGO=~/template/logo.png
DEST='resized' DEST='resized'
OPTIONS='-depth 8 -quality 80 -strip -interlace Plane' OPTIONS='-depth 8 -quality 90 -strip -interlace Plane'
# Defining some colors for log() # Defining some colors for log()
RED="\E[31m" RED="\E[31m"
@ -49,7 +49,7 @@ fi
# For each files # For each files
for image in {*.jpg,*.JPG} ; do for image in {*.jpg,*.JPG} ; do
if [ ! -f ${image} ] ; then if [ ! -f "${image}" ] ; then
echo -e "${RED}# No file found in ${PWD}${RESET}" echo -e "${RED}# No file found in ${PWD}${RESET}"
continue continue
fi fi
@ -87,7 +87,7 @@ for image in {*.jpg,*.JPG} ; do
else else
echo -e "${RED}Converting image ${image}${RESET}" echo -e "${RED}Converting image ${image}${RESET}"
convert -resize ${MAXWIDTH}x${MAXHEIGHT} ${image} ${DEST}/${image} convert -resize ${MAXWIDTH}x${MAXHEIGHT} "${image}" "${DEST}/${image}"
composite ${OPTIONS} -gravity SouthEast ${LOGO} ${DEST}/${image} ${DEST}/${image} composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DEST}/${image}" "${DEST}/${image}"
fi fi
done done