updated jpg script

master
Some guy named Michael 4 months ago
parent f7b37d2dc1
commit 89bbe5f649
No known key found for this signature in database

@ -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"
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

Loading…
Cancel
Save