Archive

bash

Using bash and ImageMagick we can crop all the pictures in a folder in a single shoot:

fix='crop'
it=1
for file in $2/*; 
do
    if [[ -f $file ]]; 
    then
        output=$2/${fix}${it}.png
        echo "$file --> $output"
        convert -crop $1 "$file" "$output"
        it=$((it+1))
    fi
done

The script, called crop.sh is run as:

./crop.sh 525x240+675+150 ~/Pictures/

The first argument is the argument for the ImageMagick’s crop tool and the second argumen is the folder where the pictures to be cropped are.

Advertisements