Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save image x debug statements #633

Merged
merged 3 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/saveImageDay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ fi

# Resize the image if required
if [[ $IMG_RESIZE == "true" ]]; then
convert "$IMAGE_TO_USE" -resize "$IMG_WIDTH"x"$IMG_HEIGHT" "$IMAGE_TO_USE"
[ "${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
Expand All @@ -31,7 +32,8 @@ 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"
[ "${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
Expand Down Expand Up @@ -68,6 +70,7 @@ fi
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"
if [ $? -ne 0 ] ; then
echo -e "${YELLOW}*** ${ME}: WARNING: RESIZE_UPLOADS failed; continuing with larger image.${NC}"
Expand Down
4 changes: 4 additions & 0 deletions scripts/saveImageNight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down