I am creating pages in Scribus via scripting to place text and images. I wish to use pyexviv2 to read/write Exif XPKeywords. Reading from is fine by using 'human_value' to convert from the byte values returned. I realise I do not need to convert except to see that it worked. I am splitting the obtained string from one tag and wish to write one part to another tag. I understand that I cannot use 'human_value' in reverse (read only). Can somebody point me in the right direction please? Below, progress so far, obtaining the 5th part of the filename, which works fine.
[EDIT] Adding... metadata['Exif.Image.XPKeywords']=parts[4] to write gives ValueError: Invalid Value.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scribus #will test that Scribus is running
import pyexiv2
import string
metadata = pyexiv2.ImageMetadata('j:/BOOK/Banns/1.jpg')
metadata.read()
metadata.exif_keys
['Exif.Image.ImageDescription',
'Exif.Image.DocumentName',
'Exif.Image.XPComment',
'Exif.Image.XPAuthor',
'Exif.Image.XPSubject',
'Exif.Image.XPKeywords',
'Exif.Image.DateTime',
'Exif.Image.Artist',
'Exif.Image.Copyright',
'Exif.Image.ExifTag']
tag=metadata['Exif.Image.DocumentName']
txt=tag.human_value
scribus.messageBox("", txt) #instead of raw_value or just value
parts=txt.split(',',5) #Split filename at ',' i.e. 5 strings in a List
scribus.messageBox("",parts[4]) #Separate Place from List