Set Exif.Image.XPAuthor

Asked by Martin Trinks

I use a python script renaming and copying some jpg-files and also the set the Exif,Image.XPAuthor. For the last I use the following code:

import pyexiv2 as pe

def set_author(file_rel_path, author):
    metadata = pe.ImageMetadata(file_rel_path)
    metadata['Exif.Image.XPAuthor'] = pe.string_to_undefined(author.encode('utf-16'))

There, both parameters are stings, the first is the path of the file to change and the second is the author which should be written to the file.

If I use this for a new photo I made, it doesn't work. But if I use it after the Author was changed "manually" using the properties window in windows explorer, all works fine.

What do I have to change, such that it works in every case, i,e., also for "new" pictures?

System: Windows XP and Python 2.7, pyexiv2 0.3.0.

Thanks in advance.
Martin Trinks

Question information

English Edit question
pyexiv2 Edit question
Olivier Tilloy Edit question
Solved by:
Martin Trinks
Last query:
Last reply:
Revision history for this message
Olivier Tilloy (osomon) said :

Hi Martin,

I just tested setting 'Exif.Image.XPAuthor' on a new image that didn’t contain the tag before, and it works well for me. That’s on linux though, so it is very possible that the issue you are experiencing is a windows-only problem.
Unfortunately I don’t have a windows machine at hand to test right now, and I won’t have time to do so before next week, but I’ll sure test and file a bug accordingly if needed.

Revision history for this message
Launchpad Janitor (janitor) said :

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Olivier Tilloy (osomon) said :

Launchpad’s janitor was a bit too quick in considering this question expired. Keeping it open until I get a chance to test on a windows machine.

Revision history for this message
Martin Trinks (martin-trinks) said :

I have the same problem when using directly the command line options of exiv2. Hence, it seems not to be a problem with pyexiv2, but with exiv2. I will try to solve the problem there. I'm sorry for assigning the problem to pyexiv2.