You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
5 years ago
|
#!/bin/bash
|
||
|
|
||
5 years ago
|
# A command line photograph EXIF comment inserter was built to annotate photo files inside the files themselves.
|
||
|
# The tool also comes with a reader to go through the annotations in the terminal. See readcomments.sh.
|
||
|
# https://git.vvvvvvaria.org/varia/EXIF-image-commenter
|
||
|
|
||
|
# How to use it?
|
||
|
# $ sh addcomments.sh [foldername]
|
||
|
|
||
|
for f in $(ls $1); do
|
||
5 years ago
|
|
||
|
# First display the image ...
|
||
|
|
||
|
# Check if Chafa is installed, otherwise use feh
|
||
|
if ! [ -x "$(command -v chafa)" ]; then
|
||
5 years ago
|
feh $1/$f
|
||
5 years ago
|
else
|
||
5 years ago
|
chafa $1/$f
|
||
5 years ago
|
fi
|
||
|
|
||
|
# Then read the current comment of this image ...
|
||
|
|
||
5 years ago
|
CURRENT=$(exiftool -S -Comment $1/$f | sed 's/[^ ]* //')
|
||
5 years ago
|
echo "Currently this image is described as: $CURRENT"
|
||
|
|
||
|
# Ask if the comment should be changed ...
|
||
|
|
||
|
read -p "Would you like to edit this comment? [y/n] " choice
|
||
|
|
||
|
case "$choice" in
|
||
|
y|Y ) read -p "Please enter your new comment: " comment ;;
|
||
|
n|N ) echo "Oke" && comment=$CURRENT;;
|
||
|
* ) echo "Sorry that is invalid. Please choose y or n.";;
|
||
|
esac
|
||
|
|
||
|
# Save the new comment into the exif data
|
||
|
|
||
5 years ago
|
exiftool $1/$f -overwrite_original -Comment="$comment"
|
||
5 years ago
|
done
|