In LibreOffice, go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add the following macro to Module1
.
Sub InsertSlideWithBackgroundImage(imageFilePath)
imageFileURL = ConvertToURL(imageFilePath)
oDoc = ThisComponent
oBackground = oDoc.createInstance("com.sun.star.drawing.Background")
oBitmaps = ThisComponent.createInstance( "com.sun.star.drawing.BitmapTable")
iBitmap = 1
Do
sBitmapName = "bk" & iBitmap
iBitmap = iBitmap + 1
Loop Until Not oBitmaps.hasByName(sBitmapName)
oBitmaps.insertByName(sBitmapName, imageFileURL)
oBackground.FillStyle = com.sun.star.drawing.FillStyle.BITMAP
oBackground.FillBitmapURL = oBitmaps.getByName(sBitmapName)
oSlideList = oDoc.getDrawPages()
oSlide = oSlideList.insertNewByIndex(oSlideList.Count)
oSlide.Background = oBackground
End Sub
Then add an image from the command line like this.
loimpress "file.odp" "macro:///Standard.Module1.InsertSlideWithBackgroundImage(image.jpg)"
Alternatively, run python3
from the command line and interact with a listening instance of LibreOffice. This approach is explained at http://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html.
EDIT:
To run it directly, pass the file path of the image.
Sub Test1
Call InsertSlideWithBackgroundImage("/path/to/your_image.jpg")
End Sub