Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:slyfox:scripts:slyexif [16/06/2017 23:21] Slyfox [Introduction] |
utilisateurs:slyfox:scripts:slyexif [22/06/2017 18:26] Slyfox [Installation] |
||
---|---|---|---|
Ligne 19: | Ligne 19: | ||
<code root>apt-get install yad libimage-exiftool-perl ffmpeg</code> | <code root>apt-get install yad libimage-exiftool-perl ffmpeg</code> | ||
- | Ensuite il suffit de créer un fichier vierge, le nommer "SlyExif" et de copier/coller le script ci-dessous.\\ | + | Installation de SlyExif. |
- | N'oublions pas de rendre exécutable "SlyExif", pour ce faire clic droit sur le fichier "SlyExif" --> "Propriétés" --> Onglet "Permissions" et cochons "Autoriser l’exécution du fichier comme un programme". | + | <code user>dget -x https://mentors.debian.net/debian/pool/main/s/slyexif/slyexif_20170621.0.dsc |
+ | tar Jxvf slyexif_20170621.0.tar.xz | ||
+ | cd slyexif/ | ||
+ | dpkg-buildpackage -us -uc | ||
+ | cd ../.</code> | ||
- | ===== Utilisation ===== | + | <code root>dpkg -i slyexif_20170621.0_amd64.deb</code> |
- | Il suffit de faire un double clic sur le fichier "SlyExif" et choisir <key>Lancer dans un Terminal</key> ou <key>Lancer</key>.\\ | ||
- | ===== Script ===== | + | ===== Utilisation ===== |
- | <file SlyExif.sh> | + | Il suffit de faire un double clic sur le fichier "SlyExif" et choisir <key>Lancer dans un Terminal</key> ou <key>Lancer</key>.\\ |
- | #! /bin/bash | + | |
- | + | ||
- | # Auteur: Slyfox | + | |
- | # Dépendence: yad, libimage-exiftool-perl, ffmpeg | + | |
- | + | ||
- | #======================================================================================================================================= | + | |
- | # Script qui supprime les métadonnées des images jpg/jpeg/png. | + | |
- | # Edition de la date de création des images. | + | |
- | # (version en test) | + | |
- | #======================================================================================================================================= | + | |
- | YADMENU() | + | |
- | { | + | |
- | yadMenu=$(yad --list --radiolist \ | + | |
- | --title "SlyExif" \ | + | |
- | --width="300" \ | + | |
- | --height="200" \ | + | |
- | --print-column="2" \ | + | |
- | --hide-column="2" \ | + | |
- | --button="gtk-quit:1" \ | + | |
- | --button="gtk-ok:0" \ | + | |
- | --column="" --column="" --column="" \ | + | |
- | "TRUE" "1" "Editer date de création de l'image" \ | + | |
- | "FALSE" "2" "Supprimer métadonnées" | awk -F [\|] '{print $1}') | + | |
- | + | ||
- | yadID="$?" | + | |
- | + | ||
- | # Navigation | + | |
- | if [[ "${yadMenu}" -eq "1" ]]; then | + | |
- | YADFICHIER | + | |
- | + | ||
- | elif [[ "${yadMenu}" -eq "2" ]]; then | + | |
- | YADFICHIERMULTIPLE | + | |
- | + | ||
- | elif [[ $yadID -eq "1" ]]; then | + | |
- | exit | + | |
- | + | ||
- | elif [[ $yadID -eq "252" ]]; then | + | |
- | exit | + | |
- | + | ||
- | fi | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | function YADFICHIER() | + | |
- | { | + | |
- | cheminImage=$(yad --file \ | + | |
- | --title "SlyExif" \ | + | |
- | --width="700" \ | + | |
- | --height="500" \ | + | |
- | --separator="\n" \ | + | |
- | --center \ | + | |
- | --filename="${cheminDossier}" \ | + | |
- | --file-filter="Images (jpg - jpeg - png)| *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG" \ | + | |
- | --file-filter "Tous | *" \ | + | |
- | --add-preview \ | + | |
- | --button="Menu:1" \ | + | |
- | --button="Suivant:0") | + | |
- | + | ||
- | yadID="$?" | + | |
- | + | ||
- | # Navigation | + | |
- | if [[ $yadID -eq "0" ]]; then | + | |
- | YADEDIT | + | |
- | + | ||
- | elif [[ $yadID -eq "1" ]]; then | + | |
- | YADMENU | + | |
- | + | ||
- | elif [[ $yadID -eq "252" ]]; then | + | |
- | exit | + | |
- | + | ||
- | fi | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | function YADEDIT() | + | |
- | { | + | |
- | warning="" | + | |
- | + | ||
- | # Redimensionnement image pour aperçu | + | |
- | ffmpeg -y -i "${cheminImage}" -vf scale=200:-1 "$HOME/.slyexif/image_tmp.jpeg" | + | |
- | + | ||
- | dateTimeOriginal=$(exiftool "${cheminImage}" | awk '/Date\/Time Original/ {print $4}' | awk 'NR==1 {print $0}') | + | |
- | + | ||
- | if [[ -z "${dateTimeOriginal}" ]]; then | + | |
- | dateTimeOriginal=$(date '+%Y:%m:%d') | + | |
- | warning=(Avertissement\ la\ date\ et\ l\'heure\ réelles\ de\ l\'image\ n\'ont\ pas\ pu\ être\ trouvées.!gtk-dialog-warning) | + | |
- | fi | + | |
- | + | ||
- | heureTimeOriginal=$(exiftool "${cheminImage}" | awk '/Date\/Time Original/ {print $5}' | awk 'NR==1 {print $0}') | + | |
- | + | ||
- | if [[ -z "${heureTimeOriginal}" ]]; then | + | |
- | heureTimeOriginal=$(date '+%H:%M:%S') | + | |
- | fi | + | |
- | + | ||
- | yadDate=$( | + | |
- | yad --form \ | + | |
- | --title "SlyExif" \ | + | |
- | --width="700" \ | + | |
- | --height="200" \ | + | |
- | --image="$HOME/.slyexif/image_tmp.jpeg" \ | + | |
- | --date-format="%Y:%m:%d" \ | + | |
- | --columns 1 \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="<span foreground='black'><b>Chemin fichier image: </b></span>":LBL " " \ | + | |
- | --field="${cheminImage}":LBL "${cheminImage}" \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="<span foreground='black'><b>Date création image: </b></span>":LBL " " \ | + | |
- | --field=" ":DT "${dateTimeOriginal}" \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="<span foreground='black'><b>Heure création image: </b></span>":LBL " " \ | + | |
- | --field=" ":CBE "${heureTimeOriginal}!00:00:00!00:30:00!01:00:00!01:30:00!02:00:00!02:30:00!03:00:00!03:30:00!04:00:00!04:30:00!05:00:00!05:30:00!06:00:00!06:30:00!07:00:00!07:30:00!08:00:00!08:30:00!09:00:00!09:30:00!10:00:00!10:30:00!11:00:00!11:30:00!12:00:00!12:30:00!13:00:00!13:30:00!14:00:00!14:30:00!15:00:00!15:30:00!16:00:00!16:30:00!17:00:00!17:30:00!18:00:00!18:30:00!19:00:00!19:30:00!20:00:00!20:30:00!21:00:00!21:30:00!22:00:00!22:30:00!23:00:00!23:30:00!" \ | + | |
- | --field="${warning[@]}":BTN " " \ | + | |
- | --button="gtk-cancel:2" \ | + | |
- | --button="Menu:1" \ | + | |
- | --button="Enregistrer les métadonnées:0") | + | |
- | + | ||
- | yadID="$?" | + | |
- | + | ||
- | yadDate=$(awk -F[\|] '{print $6,$9}' <<< "${yadDate}}") | + | |
- | + | ||
- | # Navigation | + | |
- | if [[ $yadID -eq "0" ]]; then | + | |
- | EDIT | + | |
- | + | ||
- | elif [[ $yadID -eq "1" ]]; then | + | |
- | YADMENU | + | |
- | + | ||
- | elif [[ $yadID -eq "2" ]]; then | + | |
- | YADMENU | + | |
- | + | ||
- | elif [[ $yadID -eq "252" ]]; then | + | |
- | exit | + | |
- | + | ||
- | fi | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | function EDIT() | + | |
- | { | + | |
- | exiftool -AllDates="${yadDate}" -overwrite_original "${cheminImage}" | + | |
- | exiftool "${cheminImage}" | + | |
- | + | ||
- | # Mémorisation du dernier dossier ouvert | + | |
- | a=$(awk 'NR==1 {printf "%s\n" ,$0}' <<< "${cheminImage}") | + | |
- | b="${a%/*}" | + | |
- | cheminDossier=$(awk '{printf "%s/" ,$0}' <<< "${b}") | + | |
- | + | ||
- | YADMENU | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | function YADFICHIERMULTIPLE() | + | |
- | { | + | |
- | cheminImage=$(yad --file \ | + | |
- | --multiple \ | + | |
- | --title "SlyExif" \ | + | |
- | --width="700" \ | + | |
- | --height="500" \ | + | |
- | --separator="\n" \ | + | |
- | --center \ | + | |
- | --filename="${cheminDossier}" \ | + | |
- | --file-filter="Images (jpg - jpeg - png)| *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG" \ | + | |
- | --file-filter "Tous | *" \ | + | |
- | --button="Menu:1" \ | + | |
- | --button="Suivant:0") | + | |
- | + | ||
- | yadID="$?" | + | |
- | + | ||
- | # Navigation | + | |
- | if [[ $yadID -eq "0" ]]; then | + | |
- | YADINFOFICHIERNETTOYER | + | |
- | + | ||
- | elif [[ $yadID -eq "1" ]]; then | + | |
- | YADMENU | + | |
- | + | ||
- | elif [[ $yadID -eq "252" ]]; then | + | |
- | exit | + | |
- | + | ||
- | fi | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | YADINFOFICHIERNETTOYER() | + | |
- | { | + | |
- | yadchoix=$(yad --form \ | + | |
- | --title="SlyExif" \ | + | |
- | --center \ | + | |
- | --scroll \ | + | |
- | --width="700" \ | + | |
- | --height="500" \ | + | |
- | --button="Menu:1" \ | + | |
- | --button="Supprimer les métadonnées:0" \ | + | |
- | --image="gtk-dialog-warning" \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="Supprimer toutes les métadonnées y compris les dates":CHK "FALSE" \ | + | |
- | --field="<span foreground='red'><b>\n\nFichier(s) dont les métadonnées seront supprimées ! </b></span>":LBL "" \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="":LBL "" \ | + | |
- | --field=" ":LBL "" \ | + | |
- | --field="${cheminImage}":LBL "") | + | |
- | + | ||
- | yadchoix=$(awk -F[\|] '{print $2}' <<< "${yadchoix}") | + | |
- | + | ||
- | yadID="$?" | + | |
- | + | ||
- | # Navigation | + | |
- | if [[ "${yadID}" -eq "0" ]]; then | + | |
- | NETTOYAGE | + | |
- | + | ||
- | elif [[ $yadID -eq "1" ]]; then | + | |
- | YADMENU | + | |
- | + | ||
- | elif [[ $yadID -eq "252" ]]; then | + | |
- | exit | + | |
- | + | ||
- | fi | + | |
- | + | ||
- | } | + | |
- | #======================================================================================================================================= | + | |
- | function NETTOYAGE() | + | |
- | { | + | |
- | # Calcul nombre fichiers sélectionnés | + | |
- | IFS=$'\n' | + | |
- | + | ||
- | nbrFichier=0 | + | |
- | + | ||
- | for i in ${cheminImage}; do | + | |
- | ((nbrFichier+=1)) | + | |
- | done | + | |
- | + | ||
- | pourcentFichier=$(echo "scale=9; 100/${nbrFichier}" | bc) | + | |
- | + | ||
- | pourcent="0" | + | |
- | nbr="1" | + | |
- | + | ||
- | IFS=$'\n' | + | |
- | + | ||
- | for i in ${cheminImage}; do | + | |
- | + | ||
- | extention=$(awk -F [.] '{print $NF}' <<< "${i}") | + | |
- | + | ||
- | if [[ ${extention} == "jpg" ]] || [[ ${extention} == "JPG" ]] || | + | |
- | [[ ${extention} == "jpeg" ]] || [[ ${extention} == "JPEG" ]] || | + | |
- | [[ ${extention} == "png" ]] || [[ ${extention} == "PNG" ]]; then | + | |
- | + | ||
- | dateSave=$(exiftool "${i}" | awk '/Date\/Time Original/ {print $(NF-1),$NF}') | + | |
- | + | ||
- | exiftool -all= "${i}" -overwrite_original | + | |
- | + | ||
- | if [[ "${yadchoix}" == "FALSE" ]]; then | + | |
- | + | ||
- | exiftool -AllDates="${dateSave}" -overwrite_original "${i}" | + | |
- | fi | + | |
- | + | ||
- | exiftool "${i}" | + | |
- | + | ||
- | # Mémorisation du dernier dossier ouvert | + | |
- | a=$(awk 'NR==1 {printf "%s\n" ,$0}' <<< "${i}") | + | |
- | b="${a%/*}" | + | |
- | cheminDossier=$(awk '{printf "%s/" ,$0}' <<< "${b}") | + | |
- | + | ||
- | pourcent=$(echo "scale=9; (${pourcent} + ${pourcentFichier})" | bc) | + | |
- | pourcentDigit=$(awk '{printf "%d" ,$1}' <<< "${pourcent}") | + | |
- | + | ||
- | + | ||
- | if [[ "${pourcentDigit}" -ge "100" ]]; then | + | |
- | echo "99" | + | |
- | echo -e "\n#Nombre de fichiers modifiés ${nbr} sur ${nbrFichier}" | + | |
- | sleep 3 | + | |
- | + | ||
- | else | + | |
- | echo "${pourcent}" | + | |
- | ((nbr+=1)) | + | |
- | echo -e "\n#Nombre de fichiers modifiés ${nbr} sur ${nbrFichier}" | + | |
- | fi | + | |
- | + | ||
- | else | + | |
- | + | ||
- | echo "ERREUR ! Fichier pas pris en charge par SlyExif." | + | |
- | + | ||
- | fi | + | |
- | + | ||
- | done | yad --progress --title="SlyExif" --auto-close --auto-kill | + | |
- | + | ||
- | + | ||
- | YADMENU | + | |
- | } | + | |
- | #======================================================================================================================================= | + | |
- | + | ||
- | # Lancement du script | + | |
- | etatPaquet=$(dpkg --get-selections | awk '{if ($1 == "yad") {print $2}}') | + | |
- | [[ "${etatPaquet}" != "install" ]] && echo -e "\nLe paquet \"yad\" n'est pas installé, merci de l'installer.\n" && exit | + | |
- | etatPaquet=$(dpkg --get-selections | awk '{if ($1 == "libimage-exiftool-perl") {print $2}}') | ||
- | [[ "${etatPaquet}" != "install" ]] && echo -e "\nLe paquet \"libimage-exiftool-perl\" n'est pas installé, merci de l'installer.\n" && exit | ||
- | etatPaquet=$(dpkg --get-selections | awk '{if ($1 == "ffmpeg") {print $2}}') | ||
- | [[ "${etatPaquet}" != "install" ]] && echo -e "\nLe paquet \"ffmpeg\" n'est pas installé, merci de l'installer.\n" && exit | ||
- | cheminDossier="$HOME/Images" | ||
- | [[ ! -d "$HOME/.slyexif" ]] && mkdir "$HOME/.slyexif" | ||
- | |||
- | YADMENU | ||
- | </file> |