Image shrink bash script
- #!/bin/sh
- # Description: Little script to shrink all images in the current folder.
- # That's convenient if you want to send them by mail or want to upload it to facebook.
- # Author: Gerhard Gappmeier
- # License: GPL - GNU General Public License
- if [ -e small ]; then
- echo "folder 'small' exists"
- else
- echo "creating folder 'small'"
- mkdir small
- fi
- for file in *.{jpg,JPG}; do
- if [ -e "$file" ]; then
- if [ -e "small/$file" ]; then
- echo "Skipping '$file', because 'small/$file' already exists."
- else
- echo "Converting '$file'..."
- convert -resize 1024 "$file" "small/$file"
- fi
- fi
- done