Massive conversion of Images size/resolution on Linux

Your linux Plaform requires the following:

ImageMagick

Inintial command line used:

convert -resize 50% -quality 80 input.jpg output.jpg

The following command can be used based on defined variables from the script available below:

for i in *.JPG; do convert -resize 800×600! -quality 75 “$i” web/”$i”; done

#!/bin/bash

# SET PICTURE’S PATH
path=/home/user/Photos/

# set variable date
NOW=$(date +”%d-%m-%y”)

# condition
if [ -d $path/$NOW ] ; then

# does exist
cd $path/$NOW

# creating the folder for lower def
mkdir web

for i in *.JPG; do convert -resize 800×600! -quality 75 “$i” web/”$i”; done
echo ‘created sub-folder called web and generated jpg’

else
# does not exist
echo ‘folder is not present’

fi

Leave a Reply