![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
First Cup of Ubuntu
![]() Join Date: Feb 2005
Beans: 4
|
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 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 |
|
|
|
|
|
#2 |
|
Gee! These Aren't Roasted!
![]() Join Date: Nov 2004
Location: Anywhere
My beans are hidden!
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
Good very good.
thks for all your work. |
|
|
|
|
|
#3 |
|
Quad Shot of Ubuntu
![]() Join Date: Dec 2004
Location: Finland
Beans: 400
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
Thanks. I used to have a much simpler (and worse) script for this.
I used an entry dialog for size input: Code:
SIZE=`zenity --entry --title "Create thumbnails" --text "Biggest thumbnail dimension (pixels)"` - Add more image filetypes or just try to resize all files. As far as I know, convert doesn't crash trying to resize non-image files, they will just be skipped. - Close the progress window on completion with "--auto-close" |
|
|
|
|
|
#4 |
|
5 Cups of Ubuntu
![]() Join Date: Nov 2004
Beans: 29
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
This is great. For you script-writing people I have a suggestion for something I needed a few times. I often want to email a picture to someone, but want to rescale it first. This script is most helpful in doing so. But it would be even more cool (IMO) to have, in addition, a script that does exactly what this script does, except that it should attach the files to an email instead of writing it to a new folder. Does anyone know how to do that?
|
|
|
|
|
|
#6 |
|
Gee! These Aren't Roasted!
![]() Join Date: Nov 2004
Location: Anywhere
My beans are hidden!
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
Problem: When enter one of my directory's with jpeg files, i press the create thumbs script, i choose the size but then....
The progress bar appears as full with the last jpeg bellow, i press ok, i enter the thumbs folder automatic generated....BUT NO Jpeg files inside!!!!! Odd |
|
|
|
|
|
#7 | |
|
First Cup of Ubuntu
![]() Join Date: Feb 2005
Beans: 4
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
Quote:
I'll modify the script and follow above advises to improve it... |
|
|
|
|
|
|
#8 |
|
A Carafe of Ubuntu
![]() Join Date: Apr 2005
Location: Xpain
Beans: 116
Ubuntu 9.04 Jaunty Jackalope
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
I've made some little changes on original script, just to avoid some bash scripting errors. Here's the code:
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}" == "" ]; 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 -l`
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
Last edited by infinito; May 19th, 2005 at 10:19 AM.. |
|
|
|
|
|
#9 |
|
Ubuntu Espresso Roast
![]() |
Re: HOWTO : 2 clicks resizing pictures with Nautilus
freeflight: Nice script, thanks for shareing.
Infinito: Nice details, although it seems you missed a " after thumbnails/"${i} , and the entire last line. Regards, |
|
|
|
|
|
#10 | |
|
Gee! These Aren't Roasted!
![]() Join Date: Nov 2004
Location: Anywhere
My beans are hidden!
|
Re: HOWTO : 2 clicks resizing pictures with Nautilus
Quote:
Just see the screenshots. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|