a shell script to aid the adding of EXIF comments in photographs or images of most types.
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.

39 lines
1.1 KiB

#!/bin/bash
# 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
# First display the image ...
# Check if Chafa is installed, otherwise use feh
if ! [ -x "$(command -v chafa)" ]; then
feh $1/$f
else
chafa $1/$f
fi
# Then read the current comment of this image ...
CURRENT=$(exiftool -S -Comment $1/$f | sed 's/[^ ]* //')
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
exiftool $1/$f -overwrite_original -Comment="$comment"
done