Archive for the 'nautilus' Category

Create thumbnails giving attention to the orientation

Every now and then I need to get thumbnails of my pictures. I found some solutions, that create thumbnails, but none of them gave attention to the orientation of the image. So if I wanted to resize the images to 640×480 than the landscape pictures had a correct resolution of 640×480px but the portrait pictures had something like 640×850 or even 640×480 (deforming the picture to landscape). So I wrote a script to do this job for me.

Installation

You need to install imagemagick to get the script working. (sudo apt-get install imagemagick).

I installed the script as nautilus-script.

  1. Download the thumbnail-script and modify the script to your needs (See more at the bottom)
  2. Create the folder “~/.gnome2/nautilus-scripts/” and copy the script into this folder named create_tn
  3. Make it executable
    (chmod a+x ~/.gnome2/nautilus-scripts/create_tn)
  4. Restart nautilus per killall nautilus
  5. Now you can start the script by going into the folder where your original images are and right click anywhere in the white area or on a file and select Scripts -> create_tn.

Now the script creates thumbnails of all the images of your current directory and places it into the subfolder thumbnails.

Modify the script to your needs

  • Change the resolution of the thumbnails: Change the variables long and short in line 4 and 5. eg. use long=”1024″ and short=”768″ if you want a landscape resolution of 1024×768 and portrait resolution of 768×1024.
  • Ask every time for a resolution: If you want every time another resolution just uncomment the lines 11-14. Now you can enter every time you start the script a resolution like 800×600 or 1024×768 so width x height without spaces.
  • Use a better quality: The script uses a quality of 80% for image resizing. If you need a better one you can change it in line 34 by modifying the number after “-quality”. So you can replace 80 by 60, 100 or every other integer number you want.

Script-Sourcecode

If the Download from Rapidshare does not work you can copy and save the source:

#!/bin/bash
# Define a fixed resolution
long=“110″
short=“82″
## Enter a resolution every time
## Uncomment the next lines if you want to enter the resolution
## each time manually
#resolution=`zenity –entry –text=”Resolution: (eg. 1024×768)”`
#posx=`expr index $resolution x`
#long=${resolution:0:$posx-1}
#short=${resolution:$posx}
# Filecount for progressbar
progress=0
filecount=`find -maxdepth 1 -iname “*.jpg” | wc -l`
let “inc=100/$filecount”
mkdir -p thumbnails
# Creating thumbnails
(for i in *.jpg *.JPG; do
echo “$progress”;
echo “# Resizing $i”;
width=`identify -format %w $i`
height=`identify -format %h $i`
if [ $width -ge $height ]; then
size=“${long}x${short}”
else
size=“${short}x${long}”
fi
convert -resize $size -quality 80 $i thumbnails/$i
let “progress+=$inc”
done
) | zenity progress title “$Creating thumbnails…” percentage=0

HowTo use Mozilla Thunderbird in Nautilus’ Send To… instead of Evolution (for Attachments)

Menu Screenshot Nautilus Script SendtoIf you want to send an E-Mail quickly per Mozilla Thunderbird in Nautilus like the Send To Feature you have to write a little script. (I found a .deb for replacing Evolution with Thunderbird, but it did not work. Instead it killed the whole feature. At the end you will get a menu like the one in the screenshot on the right.

  1. Because I do not need Evolution in Nautilus I removed the nautilus-sento app. To do this execute the following: sudo apt-get remove nautilus-sendto.
  2. Create a file in ~/.gnome2/nautilus-scripts named sendto.
  3. Make it executable with chmod a+x sendto
  4. Paste the following one-liner into the file and save it
    thunderbird -compose attachment="file://$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
    Note
    : If you have Thunderbird 1.5 (or minor?) you must replace “thunderbird” with “mozilla-thunderbird”.
  5. Restart Nautilus with killall nautilus

Now you can right click on a file and select Scripts -> sendto to send a file as an attachment in Thunderbird.

For more scripts you can goto Nautilus File Manager Scripts.

Add a place to Places in Nautilus for time saving

Free Image Hosting at www.ImageShack.us When I am working with OpenOffice.org or another application I often want to save my files to /media//media/sda5/docs/study/1introdcution/2. Semester. Always navigating to this folder is a waste of time and annoys me. So I thought there must be a way to have a direct link to the directory like Desktop or Home Folder.

The way to get an entry like the one above for OOo is easy:

  1. In nautilus go to the directory you want to to have an entry for, like /media//media/sda5/docs/study/1introdcution/2. Semester
  2. In the menu click Bookmarks -> Add Bookmark or simply press <cntrl>+<d>

Now you are done. You can now see your bookmark in Places and the file dialogs.