Fixed bug on file with space and optimize png
This commit is contained in:
parent
b0b7b19c1a
commit
f2922581c8
1 changed files with 7 additions and 5 deletions
|
@ -60,8 +60,8 @@ for image in {*.jpg,*.JPG} ; do
|
|||
fi
|
||||
|
||||
# Extract image dimensions
|
||||
WIDTH=`identify -format "%[fx:w]" ${image}`
|
||||
HEIGHT=`identify -format "%[fx:h]" ${image}`
|
||||
WIDTH=`identify -format "%[fx:w]" "${image}"`
|
||||
HEIGHT=`identify -format "%[fx:h]" "${image}"`
|
||||
|
||||
# Compute image ratio
|
||||
TMPIMAGERATIO=`bc -l <<< "${WIDTH}/${HEIGHT}"`
|
||||
|
@ -95,13 +95,13 @@ for image in {*.jpg,*.JPG} ; do
|
|||
echo -e "${GREEN}Converting cover file${RESET}"
|
||||
|
||||
# Crop image with the good ratio
|
||||
convert -gravity Center -crop ${NEWWIDTH}x${NEWHEIGHT}+0+0 +repage ${image} /tmp/${image}
|
||||
convert -gravity Center -crop ${NEWWIDTH}x${NEWHEIGHT}+0+0 +repage "${image}" "/tmp/${image}"
|
||||
|
||||
# Rezise cover and save it
|
||||
convert ${OPTIONS} -resize ${COVERWIDTH}x${COVERHEIGHT} /tmp/${image} ${DEST}/${image}
|
||||
convert ${OPTIONS} -resize ${COVERWIDTH}x${COVERHEIGHT} "/tmp/${image}" "${DEST}/${image}"
|
||||
|
||||
# Remove temporary file
|
||||
rm /tmp/${image}
|
||||
rm "/tmp/${image}"
|
||||
else
|
||||
echo -e "${RED}Converting image ${image}${RESET}"
|
||||
echo -e " -> ${BLUE}Create JPG version${RESET}"
|
||||
|
@ -144,6 +144,8 @@ for image in {*.jpg,*.JPG} ; do
|
|||
|
||||
# Add logo on imagedow
|
||||
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DEST}/${filename}.png" "${DEST}/${filename}.png"
|
||||
|
||||
convert "${DEST}/${filename}.png" -type TrueColorAlpha -quality 90 -format PNG32 -background transparent -depth 8 -strip "${DEST}/${filename}.png"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue