Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp 3.0 get Metadata with Python
#2
In the meantime I think there must be a buggy Gimp.Image.serialize().

It seems to be an xml string, but Python's minidom as well as elementtree throw a parse error reading the string.

I help myself with searching the string with string functions, but it feels like computing with an abacus:
Code:
def get_metadata_value(image, tag):
 metadata = image.get_metadata().serialize()
 valueStartPos = metadata.find(tag) + len(tag) + 2
 valueStart = metadata[valueStartPos:]
 value = valueStart[:valueStart.find("<")]
 return value
Reply


Messages In This Thread
Gimp 3.0 get Metadata with Python - by Volker - Yesterday, 05:41 PM
RE: Gimp 3.0 get Metadata with Python - by Volker - 3 hours ago

Forum Jump: