Script von 2007.
Inzwischen verwende ich unter Linux normalerweise das wunderbare Digikam. Damit kann man Bilder wunderbar verwalten und natürlich auch taggen. Aber wenn man mal keine grafische Oberfläche hat (auf einem Server ..), gehts per exiftool und ein klein wenig bash auch ohne GUI.
Beispiel: alle Bilder im Verzeichnis sollen zusätzlich das Keyword "Test123" bekommen:
kwadd "Test123" '*.jpg'
(mit ' eingeklammert wird "*.jpg" nicht von der Shell sondern erst vom exiftool (Perl) aufgelöst → sehr viel schneller)
#!/bin/bash # exitag # 2007-02-14 / Hella Breitkopf / www.unixwitch.de # add/delete/show later added exif text like comments, keywords or header # just for hella's dokuwiki # if you want to use this "as is" # 1) it's entirely your problem (no guarantee) # 2) you need to create lots of symlinks pointing all to this script (exitag): # kwadd, kwshow, kwdel, titleadd, ... , subtitleadd ..., comadd ... # create these in your bin directory: # for TYPE in title subtitle com kw; # do echo ; # for ACT in add ls del; # do echo $TYPE$ACT; # ln -s exitag $TYPE$ACT; # done ; done EXIFTOOL="/usr/bin/exiftool" EXIFTOOLOPT="-overwrite_original_in_place" programname=`basename $0` function doshowtag { TRENNZEICHEN=";" echo '$FileName'$TRENNZEICHEN'$'$TYPE' ' | \ $EXIFTOOL -p - $1 | \ grep --binary-files=text $TRENNZEICHEN ### grep nach Trennzeichen wg. buggy Anzeige ### von "u30D,S410D,u410D" (Camera Model Name) ??? } function dowritetag { $EXIFTOOL $EXIFTOOLOPT -$TYPE="$TAG" $1 ; } function doaddtag { $EXIFTOOL $EXIFTOOLOPT -$TYPE+="$TAG" $1 ; } function dodeltag { $EXIFTOOL $EXIFTOOLOPT -$TYPE="" $1 ; } function dosubtag { $EXIFTOOL $EXIFTOOLOPT -$TYPE-="$TAG" $1 ; } # TYPEMATCH case $programname in titel*|title*) TYPE='HEADLINE' ;; subtitel*|subtitle*) TYPE='CAPTION-ABSTRACT' ;; com*) TYPE='COMMENT' ;; kw*) TYPE='KEYWORDS' ;; esac # ACTIONMATCH case $programname in *add) TAG=$1;shift # read tag-text and go to next option (filename(s)) while (( "$#" )); do if [[ $TYPE == "KEYWORDS" ]]; then doaddtag "$1" else dowritetag "$1" fi shift done ;; *ls|*show|*list) while (( "$#" )); do doshowtag "$1" shift done ;; *del) if [[ $TYPE == "KEYWORDS" ]]; then TAG=$1; shift while (( "$#" )); do dosubtag "$1" ; shift done else while (( "$#" )); do dodeltag "$1" ; shift done fi ;; exitag|*) while (( "$#" )); do TYPE='HEADLINE' ; doshowtag "$1" ; TYPE='CAPTION-ABSTRACT' ; doshowtag "$1" ; TYPE='COMMENT' ; doshowtag "$1" ; TYPE='KEYWORDS' ; doshowtag "$1" ; shift done esac
gilt für alle Tipps, Tricks & Spickzettel:
dies sind einfache, teils banale Notizen für meinen persönlichen Gebrauch,
die hier eher zufällig auch öffentlich lesbar sind
(vielleicht hilft es ja jemandem weiter). Verwendung auf eigene Gefahr
Fehler-Hinweise, Dankesschreiben , etc. bitte an: web.21@unixwitch.de
weitere Tools / Spickzettel