I’m using Gramps 5.1.5 on Ubuntu 22.04, and I’m trying to write a plugin that exports my family tree in a customised GEDCOM format. In particular, I’d like to, in addition to exporting the list of images for a person, also include the cropping information for each photo. I’ve written a plugin which subclasses exportgedcom.GedcomWriter
and overrides the _media
method, which is run once for each Media
object. If I have a reference to a Media
object, how can I find the MediaRef
for that object which contains its cropping information? There doesn’t seem to be a very convenient way to do that, unless I’m missing something; I hope I’m missing something
I’m pretty sure that you don’t want to be adding crop info to the _media, as a media can have more than one crop when used from more than one source. For example a media might be attached to a family, (with no crop) and to the various individuals with a crop for each.
I suggest modifying the _photo method. This is called each time a media is referenced (person, family, source, citation etc.) and already contains the photo parameter which is the MediaRef.
Then I assume you will be adding a new GEDCOM line at the level below OBJE with the crop info. I’ve seen this included with GEDCOM 7 (CROP tag) so I assume you will be doing it like this, except with _CROP, as 5.5.1 extensions should have an underscore.
Aha, thank you, that’s very useful! I’ll look into doing it that way. I’m likely to only be using my generated “gedcom + extras” internally, but it’s still good to know how to add undocumented extensions correctly, so I’ll do that too
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.