Just a small howto to let you resize a directory full of big pictures (typically from cameras) in a few click with zenity and nautilus.
Put this script (you may also need to adapt to your needs) in your nautilus script directory ~/.gnome2/nautilus-scripts/ with the name of your choice (in this example Create_thumbs) :
Code:
#! /bin/sh
# Dialog box to choose thumb's size
SIZE=`zenity --list --title="Choose the thumbnail's size" --radiolist --column="Check" --column="Size" "" "320x240" "" "640x480" "" "800x600" "" "1024x768"`
if [ $SIZE -eq ""]; then
zenity --error --text="Size not defined by user.
Please choose a size to use. "
exit 1
fi
# How many files to make the progress bar
PROGRESS=0
NUMBER_OF_FILES=`find -iname "*.jpg" -maxdepth 1 | wc`
let "INCREMENT=100/$NUMBER_OF_FILES"
mkdir -p thumbnails
# Creating thumbnails. Specific work on picture should be add there as convert's option
(for i in *.jpg *.JPG; do
echo "$PROGRESS";
echo "# Resizing $i";
convert -resize $SIZE -bordercolor black -border 10x10 -quality 50 $i thumbnails/$i
let "PROGRESS+=$INCREMENT"
done
) | zenity --progress --title "$Creating thumbnails..." --percentage=0
1. Choose a directory and launch the script by right-clicking > scripts > Create_thumbs
2. Choose the size your wish to use :
3. See the script in action :
4. A new directory appeared :
As i said, this script should be adapt to your needs. Any improvments are welcome!
Seb
Bookmarks