Hi Phil,
is there a way to add keywords to files via json (without overwriting existing keywords) or to remove some keywords?
A json file like:
[{
"SourceFile": "file1.jpg",
"Keywords": ["file1_key1","file1_key2","file1_key3"]
},
{
"SourceFile": "file2.jpg",
"Keywords": ["file2_key1","file2_key2","file2_key3"]
} ...
will set keywords to file1, file2 ... fileN. But it will replace all existing keywords in those files.
Something like exiftool -json-=file.json *.jpg to delete keywords:
[{
"SourceFile": "file1.jpg",
"Keywords": ["unwanted_key1","unwanted_key2","unwanted_key3"]
},
{
"SourceFile": "file2.jpg",
"Keywords": ["unwanted_key4","unwanted_key5","unwanted_key6"]
} ...
and exiftool -json+=file.json *.jpg to add keywords would really be great.
Regards Karl
Hi Karl,
It is easy to see how you missed this in the -csv documentation:
Special feature: −csv+=CSVFILE may be used to add items to
existing lists. This affects only list‐type tags. Also applies to
the −j option.
- Phil
Edit: I have added this to the -json section of the documentation.
Hi Phil,
Thanks for your fast answer. That's great news.
Will -csv-=CSVFILE or -json-=JSONFILE work, too? This way you could remove and add keywords in one step:
exiftool -json+=keywords_to_add.json -json-=keywords_to_remove.json *.jpg
Regards Karl
Hi Karl,
I'll look into this.
- Phil
Well, I looked into it. Unfortunately, implementation is non trivial, so I'm not sure it is worthwhile adding this feature.
- Phil
Thank you a lot for looking into it.
Btw, is it possible to remove keywords using wildcards?
exiftool -keywords-="POI/*" DIR
instead of
exiftool -keywords-="POI/castle" -keywords-="POI/church" -keywords-="POI/museum" -keywords-="POI/zoo" DIR
Regards Karl
Hi Karl,
No. To do what you want requires either an advanced formatting expression or a user-defined Composite tag. The user-defined tag solution is preferred.
- Phil
Thank you.
"*" stands for 56 different (sub-)POIs. As this (hopefully) is a one-time-task I will simply specify all 56 POIs that needs to be removed.