Created
April 11, 2022 13:51
-
-
Save fubits1/7033893029c2b0e07f402238bc5e1904 to your computer and use it in GitHub Desktop.
Mass-add metadata to JPGs / annotate with alternative descriptions, copyright etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## libraries: sed, exiftool | |
# sudo apt-get install sed libimage-exiftool-perl | |
## if output folder is needed | |
# [ -d output-folder ] || mkdir output-folder # checks if output folder exists, and create if not | |
i=0 # to track iteration cycle for lookup by row in text file with sed | |
## for each JPG | |
for filename in source-folder/*.jpg; do | |
((i++)) | |
## lookup row i in text file | |
desc="$(echo "$output" | sed "${i}q;d" alt.txt)" # capture sed output in ${desc} | |
# echo "${desc}" | |
[ -e "$filename" ] || continue # escape if no file | |
# echo "${i} - ${filename%.*} - ${desc}" # ${filename%.*} prints filename without extension | |
exiftool -mwg:copyright="CC-BY-SA 4.0" -mwg:keywords="Keyword1; Keyword2;" -mwg:description="${desc}" -xmp:title="Title" -iptc:ObjectName="Title" -mwg:creator="Author / Owner" -overwr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Task Description
Approach
${i}
${desc}
from filealt.txt
, in row${i}
exiftool
add metadata (description, copyright, title, author)Prerequisites
.txt
withNeed more Tags?
You can lookup the supported universal MWG tags as well as the specific metadata standards (i.e. Exif, IPTC, XMP) here
TODO