How do I add images to an XRReferenceImageLibrary in an Editor script?

Hi. I have been trying to add images to an XRReferenceImageLibrary using an editor script.

The class documentation says:
To create and manipulate an image library via Editor scripts, see the extension methods in .
Source: Class XRReferenceImageLibrary | AR Subsystems | 2.1.19

For me this suggests that it should be possible to manipulate the image library.

I have also found this unanswered thread:

Here’s a starting point… Not thoroughly tested.