#!/bin/bash # # Author : David Guillerm # # Copyright (C) 2005,2006 Charles Bouveyron # Copyright (C) 2013 -- modifié le 17/03/2013 par Jean François Bivert # pour dolphin et konqueror # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ---- Variable globales -------------- GBL_QUALITY=100 GBL_IMGSIZE=2048x1536 # ---- DateHeure ---------------------- DH_GRAVITY=southEast DH_POINTSIZE=27 DH_STROKE=black DH_STROKEWIDTH=3 DH_FILLCOLOR=grey # ---- CADRE ---------------------- CDE_FRAME=45x45+15+15 CDF_FRAME=15x15+5+5 CD_COLOR=#996600 if [ ! -e ~/tagphoto ]; then mkdir ~/tagphoto fi; / choix=`zenity --width=600 --height=220 --list --title="Choisissez " --column="Code" --column="Choix" --column="Description" \ DH "Date et heure" "Affiche la date et l'heure de la photo" \ TX "Texte personnalisé" "Affiche un texte personnalisé sur la photo" \ CDE "Cadre Epais" "Dessine un cadre EPAIS autour de la photo" \ CDF "Cadre Fin" "Dessine un cadre FIN autour de la photo"` if [ $choix = "TX" ]; then message=`zenity --entry --text "Entrez le texte à afficher : %d = Date seule , %D = Date et heure" --entry-text "Mon message"` fi let "i = 0" nb_images=$# # %d = Date seule # %D = Date et heure verifmsg=`echo $message|grep "%d"` if [ "$verifmsg" == "" ]; then verifmsg=`echo $message|grep "%D"` fi (while [ $# -gt 0 ]; do image=$1 #image=`basename $image` echo "`gettext '# Processing image'` `basename $image` ..." let "i += 1" if [ $choix = "DH" -o "$verifmsg" != "" ]; then dateheure=`jhead $image|grep "Date/Time"|sed -e "s/ / /g"|cut -d' ' -f4,5` heurephoto=`echo $dateheure|cut -d' ' -f2` datephoto=`echo $dateheure|cut -d' ' -f1` annee=`echo $datephoto|cut -d':' -f1` mois=`echo $datephoto|cut -d':' -f2` jour=`echo $datephoto|cut -d':' -f3` affdate="$jour-$mois-$annee $heurephoto" dmy="$jour-$mois-$annee" message=$affdate fi if [ $choix = "DH" -o $choix = "TX" ]; then if [ "$verifmsg" != "" ]; then message=`echo $verifmsg|sed -e "s/%d/$dmy/g"` message=`echo $message|sed -e "s/%D/$affdate/g"` fi convert -quality $GBL_QUALITY -resize $GBL_IMGSIZE $image \ -gravity $DH_GRAVITY -pointsize $DH_POINTSIZE -stroke $DH_STROKE -strokewidth $DH_STROKEWIDTH \ -annotate +35+13 "$message" \ -gravity $DH_GRAVITY -stroke grey -strokewidth 1 -fill $DH_FILLCOLOR \ -annotate +34+14 "$message" ~/tagphoto/`basename $image` fi if [ $choix = "CDF" ]; then convert -quality $GBL_QUALITY -resize $GBL_IMGSIZE $image -mattecolor $CD_COLOR -frame $CDF_FRAME ~/tagphoto/`basename $image` fi if [ $choix = "CDE" ]; then convert -quality $GBL_QUALITY -resize $GBL_IMGSIZE $image -mattecolor $CD_COLOR -frame $CDE_FRAME ~/tagphoto/`basename $image` fi let "progress = i*100/nb_images" echo $progress shift done ) | zenity --progress --auto-close --title="Génération des images" --text="$image" --percentage=0