From 89bbe5f6497fbb42c52b85ab9cbdeeb10f8f07dd Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 4 Oct 2024 08:43:11 -0400 Subject: [PATCH] updated jpg script --- bash/jpg | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bash/jpg b/bash/jpg index cb78678..152e8c5 100755 --- a/bash/jpg +++ b/bash/jpg @@ -4,6 +4,11 @@ # https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1 # Command: # https://zwbetz.com/convert-heic-images-to-jpg/ +# +# Other useful mogrify commands: +# -rotate 10 *.jpg # Rotates 10° clockwise +# -extent "1900x3100" -gravity center *.jpg # Crops to 1900x3100 based on the center of the image +# -resize "750x1550" # Shrinks (or grows) the image to the requested size red="$(tput setaf 1)" rst="$(tput sgr0)" @@ -47,6 +52,7 @@ keepquiet=0 filecount=0 customdir=0 +instant=0 for _arg in ${@}; do if [ $customdir -eq 1 ]; then directory="$_arg"; customdir=2; continue; fi if [ "$_arg" == "--dir" ]; then customdir=1; continue; fi @@ -56,6 +62,8 @@ for _arg in ${@}; do if [ "$_arg" == "--quiet" ]; then keepquiet=1; continue; fi if [ "$_arg" == "--png" ]; then saveasjpg=0; continue; fi if [ "$_arg" == "--jpg" ]; then saveasjpg=1; continue; fi + if [ "$_arg" == "-now" ]; then instant=1; continue; fi + if [ "$_arg" == "--now" ]; then instant=1; continue; fi done # Make sure the mogrify command is available. If this is being @@ -81,8 +89,10 @@ printf "$padding%s\n" "Directory: $directory" [ $keeporiginals -eq 0 ] && printf "$padding%s\n" "Originals: Delete" || printf "$padding%s\n" "Originals: Keep" [ $keepquiet -eq 0 ] && printf "$padding%s\n" "Output: Visible" || printf "$padding%s\n" "Output: Hidden" [ $saveasjpg -eq 0 ] && printf "$padding%s\n" "Save as: PNG" || printf "$padding%s\n" "Save as: JPG" -printf "\n%s" "Press enter to begin or ^c to exit" -read +if [ $instant -eq 0 ]; then + printf "\n%s" "Press enter to begin or ^c to exit" + read +fi [ $saveasjpg -eq 0 ] && destformat="png" || destformat="jpg" # Loop over all the .heic files in the folder