# Création du nouveau dossier s'il n'existe pas
if [ -d $NV_DOSSIER ] ;
then
echo "Le dossier reduc existe déjà"
else
mkdir $NV_DOSSIER
fi
rep=$(pwd)
jourmois=$(date +'%d%m')
# Pour toutes les photos (JPG) du répertoire
for image in *[jJ][pP][gG] ;
do
rep="${rep##*/}"
rep="${rep// /-}"
width=$(identify -format '%w' "$image")
height=$(identify -format '%h' "$image")
ratio=$(echo "scale=2; $height / $width" |bc)
echo $ratio
if [ $ratio '<' .70 ]
then
image="${image##*/}"
nv_nom=$(printf '%s_%s_%s\n' ${rep} ${jourmois} $image) #on dit merci à Fred
# Réduit l'image en 601x400
convert "$image" -resize 601x400 "$NV_DOSSIER/$nv_nom"
# fusione l'image avec un calque contenant les coins
composite -gravity center /home/sacha/Bureau/cadre.png "$NV_DOSSIER/$nv_nom" "$NV_DOSSIER/$nv_nom"
# fin de la boucle FOR
else
nv_nom=$(printf 'thai_prod_%s_%s.jpg\n' ${rep} ${jourmois}) #on dit merci à Fred
# Réduit l'image en 601x400
convert "$image" -resize 200x150 "$NV_DOSSIER/$nv_nom"
# fusione l'image avec un calque contenant les coins
composite -gravity center /home/sacha/Bureau/cadremini.png "$NV_DOSSIER/$nv_nom" "$NV_DOSSIER/$nv_nom"
fi
done
[^] # FINI!!!!
Posté par gotcha5832 . En réponse au message renommer les fichier par script en nom_dossier_jour.jpg. Évalué à 2.
# Nom du nouveau répertoire
NV_DOSSIER=reduc
# Création du nouveau dossier s'il n'existe pas
if [ -d $NV_DOSSIER ] ;
then
echo "Le dossier reduc existe déjà"
else
mkdir $NV_DOSSIER
fi
rep=$(pwd)
jourmois=$(date +'%d%m')
# Pour toutes les photos (JPG) du répertoire
for image in *[jJ][pP][gG] ;
do
rep="${rep##*/}"
rep="${rep// /-}"
width=$(identify -format '%w' "$image")
height=$(identify -format '%h' "$image")
ratio=$(echo "scale=2; $height / $width" |bc)
echo $ratio
if [ $ratio '<' .70 ]
then
image="${image##*/}"
nv_nom=$(printf '%s_%s_%s\n' ${rep} ${jourmois} $image) #on dit merci à Fred
# Réduit l'image en 601x400
convert "$image" -resize 601x400 "$NV_DOSSIER/$nv_nom"
# fusione l'image avec un calque contenant les coins
composite -gravity center /home/sacha/Bureau/cadre.png "$NV_DOSSIER/$nv_nom" "$NV_DOSSIER/$nv_nom"
# fin de la boucle FOR
else
nv_nom=$(printf 'thai_prod_%s_%s.jpg\n' ${rep} ${jourmois}) #on dit merci à Fred
# Réduit l'image en 601x400
convert "$image" -resize 200x150 "$NV_DOSSIER/$nv_nom"
# fusione l'image avec un calque contenant les coins
composite -gravity center /home/sacha/Bureau/cadremini.png "$NV_DOSSIER/$nv_nom" "$NV_DOSSIER/$nv_nom"
fi
done