Added PNG version with box-shadow
This commit is contained in:
parent
bc396d9d8f
commit
b0b7b19c1a
1 changed files with 20 additions and 2 deletions
|
@ -104,6 +104,7 @@ for image in {*.jpg,*.JPG} ; do
|
||||||
rm /tmp/${image}
|
rm /tmp/${image}
|
||||||
else
|
else
|
||||||
echo -e "${RED}Converting image ${image}${RESET}"
|
echo -e "${RED}Converting image ${image}${RESET}"
|
||||||
|
echo -e " -> ${BLUE}Create JPG version${RESET}"
|
||||||
|
|
||||||
# Compute positions for black border
|
# Compute positions for black border
|
||||||
BORDERUPPERLEFT=$((${BORDERWIDTH}/2)),$((${BORDERWIDTH}/2))
|
BORDERUPPERLEFT=$((${BORDERWIDTH}/2)),$((${BORDERWIDTH}/2))
|
||||||
|
@ -116,16 +117,33 @@ 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 ${BORDERUPPERLEFT} 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'" \
|
||||||
"${DEST}/${image}"
|
"${DEST}/${image}"
|
||||||
|
|
||||||
# Add logo on imagedow
|
# Add logo on imagedow
|
||||||
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DEST}/${image}" "${DEST}/${image}"
|
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DEST}/${image}" "${DEST}/${image}"
|
||||||
|
|
||||||
|
# Create same version but in PNG and with box shadow
|
||||||
|
echo -e " -> ${BLUE}Create PNG version${RESET}"
|
||||||
|
filename=$(basename -- "${image}")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
convert -resize ${NEWWIDTH}x${NEWHEIGHT} \
|
||||||
|
"${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 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 \) \
|
||||||
|
+swap -background transparent -layers merge +repage \
|
||||||
|
"${DEST}/${filename}.png"
|
||||||
|
|
||||||
|
# Add logo on imagedow
|
||||||
|
composite ${OPTIONS} -gravity SouthEast "${LOGO}" "${DEST}/${filename}.png" "${DEST}/${filename}.png"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue