Reputation: 21
Windows explorer has an option to add tags to image through image properties > Details > Tags Image properties.
Can I modify this using python or any other automated method (bash)?
I tried using exif library
pip install exif
But it only allows to change image title/subject through its ImageDescription attribute exif.
Further, exiftools library has an attributes XPkeywords, is it relevant for updating tags? What does it update?
Upvotes: 2
Views: 1010
Reputation: 5771
The Windows "Tags" property reads data from three different sources in the file, if they exist. They are the EXIF:XPKeywords
, the IPTC:Keywords
, and the XMP:Subject
tags. The first appears in the EXIF block, but is not part of the EXIF standard. For the most part, it's a Windows only tag that isn't read by most software.
The other two tags are part of the older IPTC IIM/Legacy standard and the newer XMP standard. These would be the tags you want to write to if you want future compatibility.
On the command line, Exiftool and Exiv2 are common tools for writing metadata into image files. They both have wrappers that will help write data using them. See PyExifTool and python-exiv2. There may be other libraries that can use but you want to make sure they can write IPTC and/or XMP data.
I believe that the EXIF library you installed only writes EXIF data, not other types of data.
Upvotes: 2