Bundle: Support ImageMagic on Windows

This commit is contained in:
2018-08-07 22:22:53 +02:00
parent f5da4a106c
commit 329da310db

View File

@@ -143,17 +143,19 @@ fi
MAGICK=`which magick`
if [ ! -z "${MAGICK}" ]; then
CONVERT="${MAGICK} convert"
CONVERT_CMD="${MAGICK}"
CONVERT_TOOL="convert"
else
if [[ "${KERNEL_NAME}" == "MINGW"* ]]; then
echo "ERROR: MAgick is not found but required on this platform"
exit 1
fi
CONVERT=`which convert`
if [ -z "${CONVERT}" ]; then
CONVERT_CMD=`which convert`
if [ -z "${CONVERT_CMD}" ]; then
echo "ERROR: ImageMagic's convert is not found, can not continue."
exit 1
fi
CONVERT_TOOL=""
fi
GIT=`which git`
@@ -337,7 +339,7 @@ fi
# Create background to stack image on.
BACKGROUND_IMAGE="${STORAGE_DIRECTORY}/background.png"
${CONVERT} -size ${IMAGE_WIDTH}x${IMAGE_HEIGHT} xc:'rgb(51,51,51)' ${BACKGROUND_IMAGE}
"${CONVERT_CMD}" ${CONVERT_TOOL} -size ${IMAGE_WIDTH}x${IMAGE_HEIGHT} xc:'rgb(51,51,51)' ${BACKGROUND_IMAGE}
# Copy scenes.
mkdir -p "${DATA_DIRECTORY}/scenes"
@@ -354,8 +356,8 @@ for scene in ${SCENES}; do
input_we=`basename "${input%.*}"`
output_scaled="${STORAGE_DIRECTORY}/${input_we}_scaled.png"
output_compo="${STORAGE_DIRECTORY}/${input_we}.png"
${CONVERT} "${input}" -resize ${IMAGE_WIDTH}x${IMAGE_HEIGHT} "${output_scaled}"
${CONVERT} ${BACKGROUND_IMAGE} "${output_scaled}" -gravity center -composite "${output_compo}"
"${CONVERT_CMD}" ${CONVERT_TOOL} "${input}" -resize ${IMAGE_WIDTH}x${IMAGE_HEIGHT} "${output_scaled}"
"${CONVERT_CMD}" ${CONVERT_TOOL} ${BACKGROUND_IMAGE} "${output_scaled}" -gravity center -composite "${output_compo}"
mv "${output_compo}" "${input}"
rm ${output_scaled}
fi