Fixed bug for cover
This commit is contained in:
parent
d23cc0079f
commit
df603da5f8
1 changed files with 15 additions and 15 deletions
|
@ -50,10 +50,10 @@ RESET="\033[0m"
|
||||||
|
|
||||||
# If destination does not exists, create it
|
# If destination does not exists, create it
|
||||||
if [ ! -d ${DESTJPG} ] ; then
|
if [ ! -d ${DESTJPG} ] ; then
|
||||||
mkdir -p ${DESTJPG}
|
mkdir -p ${DESTJPG}
|
||||||
fi
|
fi
|
||||||
if [ ! -d ${DESTPNG} ] ; then
|
if [ ! -d ${DESTPNG} ] ; then
|
||||||
mkdir -p ${DESTPNG}
|
mkdir -p ${DESTPNG}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For each files
|
# For each files
|
||||||
|
@ -64,7 +64,7 @@ for image in {*.jpg,*.JPG} ; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ `exiftool -Orientation -n "${image}" | cut -d":" -f2|cut -d' ' -f2` -eq 6 ] ; then
|
if [ `exiftool -Orientation -n "${image}" | cut -d":" -f2|cut -d' ' -f2` -eq 6 ] ; then
|
||||||
convert -auto-orient ${image} ${image}
|
convert -auto-orient ${image} ${image}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ for image in {*.jpg,*.JPG} ; do
|
||||||
# Compute new image size based on image type
|
# Compute new image size based on image type
|
||||||
if [ "${image}" == "${COVERFILE}" ] ; then
|
if [ "${image}" == "${COVERFILE}" ] ; then
|
||||||
# Compute temporary with or height to crop correctly image
|
# Compute temporary with or height to crop correctly image
|
||||||
if [ "${COVERRATIO}" -gt "${TMPIMAGERATIO}" ] ; then
|
if (( $(echo "${COVERRATIO} >= ${TMPIMAGERATIO}" | bc -l) )) ; then
|
||||||
NEWHEIGHT=$((${WIDTH}*${COVERHEIGHT}/${COVERWIDTH}))
|
NEWHEIGHT=$((${WIDTH}*${COVERHEIGHT}/${COVERWIDTH}))
|
||||||
else
|
else
|
||||||
NEWWIDTH=$((${HEIGHT}*${COVERWIDTH}/${COVERHEIGHT}))
|
NEWWIDTH=$((${HEIGHT}*${COVERWIDTH}/${COVERHEIGHT}))
|
||||||
|
@ -128,13 +128,13 @@ for image in {*.jpg,*.JPG} ; do
|
||||||
THINBORDERLOWERLEFT=${BORDERTHINPLACEMENT},$((${NEWHEIGHT}-${BORDERTHINPLACEMENT} ))
|
THINBORDERLOWERLEFT=${BORDERTHINPLACEMENT},$((${NEWHEIGHT}-${BORDERTHINPLACEMENT} ))
|
||||||
THINBORDERLOWERRIGHT=$((${NEWWIDTH}-${BORDERTHINPLACEMENT} )),$((${NEWHEIGHT}-${BORDERTHINPLACEMENT} ))
|
THINBORDERLOWERRIGHT=$((${NEWWIDTH}-${BORDERTHINPLACEMENT} )),$((${NEWHEIGHT}-${BORDERTHINPLACEMENT} ))
|
||||||
THINBORDERUPPERRIGHT=$((${NEWWIDTH}-${BORDERTHINPLACEMENT} )),${BORDERTHINPLACEMENT}
|
THINBORDERUPPERRIGHT=$((${NEWWIDTH}-${BORDERTHINPLACEMENT} )),${BORDERTHINPLACEMENT}
|
||||||
|
|
||||||
# resize and add border on image
|
# resize and add border on image
|
||||||
convert -resize ${NEWWIDTH}x${NEWHEIGHT} \
|
convert -resize ${NEWWIDTH}x${NEWHEIGHT} \
|
||||||
"${image}" \
|
"${image}" \
|
||||||
-fill transparent -stroke black -strokewidth ${BORDERWIDTH} -draw "stroke-linecap square path 'M $((${BORDERWIDTH}/2)),0 L ${BORDERLOWERLEFT} L ${BORDERLOWERRIGHT} L ${BORDERUPPERRIGHT} L ${BORDERUPPERLEFT} Z'" \
|
-fill transparent -stroke black -strokewidth ${BORDERWIDTH} -draw "stroke-linecap square path 'M $((${BORDERWIDTH}/2)),0 L ${BORDERLOWERLEFT} L ${BORDERLOWERRIGHT} L ${BORDERUPPERRIGHT} L ${BORDERUPPERLEFT} Z'" \
|
||||||
-fill transparent -stroke white -strokewidth ${BORDERTHINWIDTH} -draw "stroke-linecap square path 'M ${THINBORDERUPPERLEFT} L ${THINBORDERLOWERLEFT} L ${THINBORDERLOWERRIGHT} L ${THINBORDERUPPERRIGHT} L ${THINBORDERUPPERLEFT} Z'" \
|
-fill transparent -stroke white -strokewidth ${BORDERTHINWIDTH} -draw "stroke-linecap square path 'M ${THINBORDERUPPERLEFT} L ${THINBORDERLOWERLEFT} L ${THINBORDERLOWERRIGHT} L ${THINBORDERUPPERRIGHT} L ${THINBORDERUPPERLEFT} Z'" \
|
||||||
"${DESTJPG}/${image}"
|
"${DESTJPG}/${image}"
|
||||||
|
|
||||||
# Add logo on imagedow
|
# Add logo on imagedow
|
||||||
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DESTJPG}/${image}" "${DESTJPG}/${image}"
|
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DESTJPG}/${image}" "${DESTJPG}/${image}"
|
||||||
|
@ -146,12 +146,12 @@ for image in {*.jpg,*.JPG} ; do
|
||||||
filename="${filename%.*}"
|
filename="${filename%.*}"
|
||||||
|
|
||||||
convert -resize ${NEWWIDTH}x${NEWHEIGHT} \
|
convert -resize ${NEWWIDTH}x${NEWHEIGHT} \
|
||||||
"${image}" \
|
"${image}" \
|
||||||
-fill transparent -stroke black -strokewidth ${BORDERWIDTH} -draw "stroke-linecap square path 'M $((${BORDERWIDTH}/2)),0 L ${BORDERLOWERLEFT} L ${BORDERLOWERRIGHT} L ${BORDERUPPERRIGHT} L ${BORDERUPPERLEFT} Z'" \
|
-fill transparent -stroke black -strokewidth ${BORDERWIDTH} -draw "stroke-linecap square path 'M $((${BORDERWIDTH}/2)),0 L ${BORDERLOWERLEFT} L ${BORDERLOWERRIGHT} L ${BORDERUPPERRIGHT} L ${BORDERUPPERLEFT} Z'" \
|
||||||
-fill transparent -stroke white -strokewidth ${BORDERTHINWIDTH} -draw "stroke-linecap square path 'M ${THINBORDERUPPERLEFT} L ${THINBORDERLOWERLEFT} L ${THINBORDERLOWERRIGHT} L ${THINBORDERUPPERRIGHT} L ${THINBORDERUPPERLEFT} Z'" \
|
-fill transparent -stroke white -strokewidth ${BORDERTHINWIDTH} -draw "stroke-linecap square path 'M ${THINBORDERUPPERLEFT} L ${THINBORDERLOWERLEFT} L ${THINBORDERLOWERRIGHT} L ${THINBORDERUPPERRIGHT} L ${THINBORDERUPPERLEFT} Z'" \
|
||||||
\( +clone -background black -shadow 80x3+2+2 \) \
|
\( +clone -background black -shadow 80x3+2+2 \) \
|
||||||
+swap -background transparent -layers merge +repage \
|
+swap -background transparent -layers merge +repage \
|
||||||
"${DESTPNG}/${filename}.png"
|
"${DESTPNG}/${filename}.png"
|
||||||
|
|
||||||
# Add logo on imagedow
|
# Add logo on imagedow
|
||||||
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DESTPNG}/${filename}.png" "${DESTPNG}/${filename}.png"
|
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DESTPNG}/${filename}.png" "${DESTPNG}/${filename}.png"
|
||||||
|
|
Loading…
Reference in a new issue