#!/bin/bash ################################################# # WHAT is Rotate-Mirror_pictures ? # Script to rotate 90°, 180° or 270°, horizontal mirror, vertical mirror, automatic rotation from exif data. # Rotate-Mirror_pictures modifies the file which you select so be carefull. # If you use Rotate-Mirror_pictures script on a file all exif rotation informations are deleted ! # It cannot convert a directory but you can select several files. ################################################# # INFO # Author : yeKcim - yeknan@yahoo.fr - http://yeknan.free.fr # Licence : GNU GPL # Dependency # zenity # mogrify (in imagemagick) # jhead (used if available, can't rotate automatically without it) # Based on # WOM_audioconverter # History # 10.02.2006 : v0.3 : Patch provided by Pat Carr # : Made auto depend on jhead available # : Added spanish translation # 15.01.2006 : v0.2 : + Auto # : + Delete exif rotation informations # 05.03.2005 : v0.1 : First public version # Install # Put on ~/.gnome2/nautilus-scripts/ # In a console : chmod u+x ~/.gnome2/nautilus-scripts/Rotate-Mirror_pictures rotateopt="90 180 270 vertical horizontal" can_auto="auto" version="0.3" ################################################# # TRADUCTIONS ###### Default = English ##### title="Rotate-Mirror pictures "$version"" pleasesel="Please select at least one file." noselec=""$title" rotate pictures. "$pleasesel"" choix="Select an angle :" warning="Warning" recur=""$title" can't convert directory. "$pleasesel"" conversion="Rotation of file :" nobin="Program mogrify is not installed, please install !" nobinj="Program jhead is not installed, please install !" case $LANG in ######## Français ######## fr* ) title="Rotate-Mirror pictures "$version"" pleasesel="Merci de selectionner au moins un fichier." noselec=""$title" permet de tourner des images. "$pleasesel"" choix="Selectionnez un angle :" warning="Attention" recur=""$title" ne permet pas la conversion de dossiers. "$pleasesel"" conversion="Rotation du fichier :" nobin="Le programme mogrify n'est pas installé, veuillez l'installer !" nobinj="Le programme jhead n'est pas installé, veuillez l'installer !" ;; esac case $LANG in ######## Español ######## es* ) title="Rotate-Mirror pictures "$version"" pleasesel="Por favor seleccione al menos un archivo." noselec=""$title" permite rotar imágenes. "$pleasesel"" choix="Seleccione un ángulo :" warning="Atención" recur=""$title" no puede convertir directorios. "$pleasesel"" conversion="Rotación de archivo :" nobin="El programa mogrify no está instalado, instálelo!" nobinj="El programa jhead no está instalado, instálelo!" esac ################################################# # PROGRAMME #### Pas de fichiers sélectionné ### if [ $# -eq 0 ]; then zenity --error --title="$warning" --text="$noselec" exit 1 fi ######## Test dépendance ######## which mogrify 2>/dev/null if [ $? != 0 ] then zenity --error --title="$title" --text="$nobin" fi which jhead 2>/dev/null if [ $? != 0 ] can_auto="auto" then # comment if you don't want a warning every time it's run without jhead installed. zenity --warning --title="$title" --text="Jhead was not found, disabling auto-rotate" can_auto="" fi ######## Fenêtre principale ######## while [ ! "$choixutilisateur" ] # Réafficher la fenêtre tant que l'utilisateur n'a pas fait de choix do choixutilisateur=`zenity --title "$title" --list --column="Rotation" $rotateopt $can_auto --text "$choix" --height "250"` ###### Choix -> Sortie boucle ###### if [ $? != 0 ]; then exit 1 fi [ $? -ne 0 ] && exit 2 # Annulation done #### Rotation #### case $choixutilisateur in 90|180|270) mogrify -rotate $choixutilisateur $* ;; vertical) mogrify -flip $* ;; horizontal) mogrify -flop $* ;; auto) jhead -autorot $* ;; esac jhead -norot $*