API support for inserting images into Impress/presentation?

I’m trying to automate the insertion of local image files into Impress/presentation, specifically in an invisible way.

I found insertImages() here, but I’m not familiar enough the API to understand if it would work with Impress. I searched online and couldn’t find anyone using this specific function. If anyone has examples or insight they’d be willing to share regarding this function or a similar one it’d be appreciated.

What do you mean by “invisible way”?
Is the “API support” you want a routine (“macro”) doing the insertion? If so, how should the routine get the URL of the image?

Libre Office CLI --invisible parameter is documented here: Starting LibreOffice Software With Parameters

By API I didn’t mean macro. Though I suppose if I could open a file invisibly and run a macro that does image insertion that would work… but not sure if macros take input?

You can assume I have a string that I can pass in as input which contains the path to the local file (e.g. “~/parent_dir/child_dir/file.txt”)

Yes, I think you can load a presentation invisibe, and call a script at that time which uses the API to do something, but I never needed to start such a proceeding on system level, and don’t know the details.
It looks a bit funny to me considering the passing of parameters in specific …
In the few cases I had to manipulate a multitude of LibO files programmatically (probably unattended), the process was controlled based on scripts stored in a spreadsheet document, and reading the parameters from one of the sheets.

Concerning the keywords insert / image / presentation see also my post to [Solved] Insert an image into Draw document using Basic (View topic) • Apache OpenOffice Community Forum.

No need to call the API directly; create a macro and call it from the CLI when opening a file.

--invisible --headless [FILENAME] "vnd.sun.star.script:Standard.[MODULE_NAME].[SUBROUTINE_NAME]?language=Basic&location=application"

Will post link to working code when finished.

Your [MACRO_NAME] should read [MODULE_NAME].

I didn’t suggest to “call the API directly” - and I wouldn’t know a way to do so - but how will your Basic macro do something substantial without using the API?

Everytime the task changed a bit (read “would need a new set of parameter values”) you will need to supply a new macro containing everything hard-coded if not you make it read parameters from a file (the URL of that file hard-coded again).

Tell me what I misunderstood, please.

You didn’t misunderstand anything. I posted the answer to my own question.

Originally I thought I would have to write some Java code that interacted with the API, and be kicked off via command line. Instead, use the command line to open a file and call a macro (in this case a Basic one) that can interact with the API to do image insertion. And yes, I was able to pass in parameters by having the macro read from a file :slight_smile:

+1 on the [MODULE_NAME] change