From 071c55ce2b2406368e704020e53cb193a64f1648 Mon Sep 17 00:00:00 2001 From: EricClaeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 10 Oct 2021 18:49:06 -0500 Subject: [PATCH 1/3] saveImageDay.sh: add debug statements --- scripts/saveImageDay.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/saveImageDay.sh b/scripts/saveImageDay.sh index 0afaab23e..13bbb653e 100755 --- a/scripts/saveImageDay.sh +++ b/scripts/saveImageDay.sh @@ -14,15 +14,16 @@ IMAGE_TO_USE="$FULL_FILENAME" # quotes around $IMAGE_TO_USE below, in case it has a space or special characters. # Quick check to make sure the image isn't corrupted. -identify "$IMAGE_TO_USE" >/dev/null 2>&1 +identify "${IMAGE_TO_USE}" >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: Image '${IMAGE_TO_USE} is corrupt; ignoring.${NC}" exit 3 fi # Resize the image if required -if [[ $IMG_RESIZE == "true" ]]; then - convert "$IMAGE_TO_USE" -resize "$IMG_WIDTH"x"$IMG_HEIGHT" "$IMAGE_TO_USE" +if [[ "${IMG_RESIZE}" == "true" ]]; then + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing '${IMAGE_TO_USE}' to ${IMG_WIDTH}x${IMG_HEIGHT}" + convert "${IMAGE_TO_USE}" -resize "${IMG_WIDTH}x${IMG_HEIGHT}" "${IMAGE_TO_USE}" if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: IMG_RESIZE failed${NC}" exit 4 @@ -30,8 +31,9 @@ if [[ $IMG_RESIZE == "true" ]]; then fi # Crop the image around the center if required -if [[ $CROP_IMAGE == "true" ]]; then - convert "$IMAGE_TO_USE" -gravity Center -crop "$CROP_WIDTH"x"$CROP_HEIGHT"+"$CROP_OFFSET_X"+"$CROP_OFFSET_Y" +repage "$IMAGE_TO_USE" +if [[ "${CROP_IMAGE}" == "true" ]]; then + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Cropping ${IMAGE_TO_USE} to ${CROP_WIDTH}x${CROP_HEIGHT}" + convert "${IMAGE_TO_USE}" -gravity Center -crop "${CROP_WIDTH}x${CROP_HEIGHT}+${CROP_OFFSET_X}+${CROP_OFFSET_Y}" +repage "${IMAGE_TO_USE}" if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: CROP_IMAGE failed${NC}" exit 4 @@ -41,7 +43,7 @@ fi # IMG_DIR and IMG_PREFIX are in config.sh # If the user specified an IMG_PREFIX, copy the file to that name so the websites can display it. if [ "${IMG_PREFIX}" != "" ]; then - cp "$IMAGE_TO_USE" "${IMG_PREFIX}${FILENAME}.${EXTENSION}" + cp "${IMAGE_TO_USE}" "${IMG_PREFIX}${FILENAME}.${EXTENSION}" fi # If daytime saving is desired, save the current image in today's directory @@ -68,7 +70,8 @@ fi if [ "$UPLOAD_IMG" = true ] ; then if [[ "$RESIZE_UPLOADS" == "true" ]]; then # Create a smaller version for upload - convert "$IMAGE_TO_USE" -resize "$RESIZE_UPLOADS_SIZE" -gravity East -chop 2x0 "$IMAGE_TO_USE" + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing upload file '${IMAGE_TO_USE}' to ${RESIZE_UPLOADS_SIZE}" + convert "${IMAGE_TO_USE}" -resize "${RESIZE_UPLOADS_SIZE}" -gravity East -chop 2x0 "${IMAGE_TO_USE}" if [ $? -ne 0 ] ; then echo -e "${YELLOW}*** ${ME}: WARNING: RESIZE_UPLOADS failed; continuing with larger image.${NC}" fi From c3f164ec20f2ffab61eda53b3c74f6465bc1a2f1 Mon Sep 17 00:00:00 2001 From: EricClaeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 10 Oct 2021 19:01:58 -0500 Subject: [PATCH 2/3] saveImageNight: add debug statements --- scripts/saveImageNight.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/saveImageNight.sh b/scripts/saveImageNight.sh index 1f3d4aeb0..802071e6b 100755 --- a/scripts/saveImageNight.sh +++ b/scripts/saveImageNight.sh @@ -48,6 +48,7 @@ fi # Resize the image if required if [[ $IMG_RESIZE == "true" ]]; then + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing '${IMAGE_TO_USE}' to ${IMG_WIDTH}x${IMG_HEIGHT}" convert "$IMAGE_TO_USE" -resize "$IMG_WIDTH"x"$IMG_HEIGHT" "$IMAGE_TO_USE" RET=$? if [ $RET -ne 0 ] ; then @@ -58,6 +59,7 @@ fi # Crop the image around the center if required if [[ $CROP_IMAGE == "true" ]]; then + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Cropping ${IMAGE_TO_USE} to ${CROP_WIDTH}x${CROP_HEIGHT}" convert "$IMAGE_TO_USE" -gravity Center -crop "$CROP_WIDTH"x"$CROP_HEIGHT"+"$CROP_OFFSET_X"+"$CROP_OFFSET_Y" +repage "$IMAGE_TO_USE" RET=$? if [ $RET -ne 0 ] ; then @@ -68,6 +70,7 @@ fi # Stretch the image if [[ $AUTO_STRETCH == "true" ]]; then + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Stretching '${IMAGE_TO_USE}' by ${AUTO_STRETCH_AMOUNT}" convert "$IMAGE_TO_USE" -sigmoidal-contrast "$AUTO_STRETCH_AMOUNT","$AUTO_STRETCH_MID_POINT" "$IMAGE_TO_USE" RET=$? if [ $RET -ne 0 ] ; then @@ -98,6 +101,7 @@ fi if [[ "$UPLOAD_IMG" == "true" ]] ; then if [[ "$RESIZE_UPLOADS" == "true" ]]; then # Create smaller version for upload + [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing upload file '${IMAGE_TO_USE}' to ${RESIZE_UPLOADS_SIZE}" convert "$IMAGE_TO_USE" -resize "$RESIZE_UPLOADS_SIZE" -gravity East -chop 2x0 "$IMAGE_TO_USE" RET=$? if [ ${RET} -ne 0 ] ; then From ee816ee04816c1235d545963db78e649eee770ca Mon Sep 17 00:00:00 2001 From: EricClaeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 10 Oct 2021 19:06:16 -0500 Subject: [PATCH 3/3] saveImageDay.sh: updates --- scripts/saveImageDay.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/saveImageDay.sh b/scripts/saveImageDay.sh index 13bbb653e..28e136b8a 100755 --- a/scripts/saveImageDay.sh +++ b/scripts/saveImageDay.sh @@ -14,16 +14,16 @@ IMAGE_TO_USE="$FULL_FILENAME" # quotes around $IMAGE_TO_USE below, in case it has a space or special characters. # Quick check to make sure the image isn't corrupted. -identify "${IMAGE_TO_USE}" >/dev/null 2>&1 +identify "$IMAGE_TO_USE" >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: Image '${IMAGE_TO_USE} is corrupt; ignoring.${NC}" exit 3 fi # Resize the image if required -if [[ "${IMG_RESIZE}" == "true" ]]; then +if [[ $IMG_RESIZE == "true" ]]; then [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing '${IMAGE_TO_USE}' to ${IMG_WIDTH}x${IMG_HEIGHT}" - convert "${IMAGE_TO_USE}" -resize "${IMG_WIDTH}x${IMG_HEIGHT}" "${IMAGE_TO_USE}" + convert "$IMAGE_TO_USE" -resize "${IMG_WIDTH}x${IMG_HEIGHT}" "$IMAGE_TO_USE" if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: IMG_RESIZE failed${NC}" exit 4 @@ -31,9 +31,9 @@ if [[ "${IMG_RESIZE}" == "true" ]]; then fi # Crop the image around the center if required -if [[ "${CROP_IMAGE}" == "true" ]]; then +if [[ $CROP_IMAGE == "true" ]]; then [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Cropping ${IMAGE_TO_USE} to ${CROP_WIDTH}x${CROP_HEIGHT}" - convert "${IMAGE_TO_USE}" -gravity Center -crop "${CROP_WIDTH}x${CROP_HEIGHT}+${CROP_OFFSET_X}+${CROP_OFFSET_Y}" +repage "${IMAGE_TO_USE}" + convert "$IMAGE_TO_USE" -gravity Center -crop "${CROP_WIDTH}x${CROP_HEIGHT}+${CROP_OFFSET_X}+${CROP_OFFSET_Y}" +repage "$IMAGE_TO_USE" if [ $? -ne 0 ] ; then echo "${RED}*** $ME: ERROR: CROP_IMAGE failed${NC}" exit 4 @@ -43,7 +43,7 @@ fi # IMG_DIR and IMG_PREFIX are in config.sh # If the user specified an IMG_PREFIX, copy the file to that name so the websites can display it. if [ "${IMG_PREFIX}" != "" ]; then - cp "${IMAGE_TO_USE}" "${IMG_PREFIX}${FILENAME}.${EXTENSION}" + cp "$IMAGE_TO_USE" "${IMG_PREFIX}${FILENAME}.${EXTENSION}" fi # If daytime saving is desired, save the current image in today's directory @@ -71,7 +71,7 @@ if [ "$UPLOAD_IMG" = true ] ; then if [[ "$RESIZE_UPLOADS" == "true" ]]; then # Create a smaller version for upload [ "${ALLSKY_DEBUG_LEVEL}" -ge 4 ] && echo "${ME}: Resizing upload file '${IMAGE_TO_USE}' to ${RESIZE_UPLOADS_SIZE}" - convert "${IMAGE_TO_USE}" -resize "${RESIZE_UPLOADS_SIZE}" -gravity East -chop 2x0 "${IMAGE_TO_USE}" + convert "$IMAGE_TO_USE" -resize "$RESIZE_UPLOADS_SIZE" -gravity East -chop 2x0 "$IMAGE_TO_USE" if [ $? -ne 0 ] ; then echo -e "${YELLOW}*** ${ME}: WARNING: RESIZE_UPLOADS failed; continuing with larger image.${NC}" fi