I made a slight modification to a macro that I created to save each slide as bmp files to save as png files.
Edit to show how to call from command line.
"C:\Program Files\LibreOffice 5\program\soffice.exe" --headless zaza.odp macro:///Standard.WritePNGSlides.WritePNGSlides()
Assuming the macro code is saved in libreoffice application, My Macros & Dialogs, Standard library in module named WritePNGSlides.
Code below modified to close the document after export.
Sub WritePNGSlides()
Dim oDoc As Object
Dim oSlide As Object
Dim oDrawPages As Object
Dim oFilter As Object
Dim Args(2) As New com.sun.star.beans.PropertyValue
Dim sDirectory As String
Dim sFileName As String
Dim i As Integer
oDoc = thisComponent
If oDoc.Identifier <> "com.sun.star.presentation.PresentationDocument" Then
msgbox "Only PresentationDocument type is supported"
Exit Sub
End If
If oDoc.Location = "" Then
msgbox "Save the presentation to a folder where we will save the slide images."
Exit Sub
End If
sFileName = oDoc.Title
sDirectory = replace(oDoc.Location, "%20", " " ) ' Allow for spaces in name as %20'
sDirectory = replace(sDirectory, sFileName, "" )
sFileName = left(sFileName, instr(sFileName,".") - 1)
oDrawPages = oDoc.getDrawPages
oFilter=CreateUnoService("com.sun.star.drawing.GraphicExportFilter")
For i = 0 To oDrawPages.Count - 1
oSlide = oDrawPages.getByIndex(i)
' msgbox "test calling macro from command line" & chr(10) & oSlide.name ' Debug only
oFilter.setSourceDocument(oSlide)
Args(0).Name = "URL"
Args(0).Value = sDirectory & sFileName & "_" & oSlide.name & ".png"
Args(1).Name = "MediaType"
Args(1).Value = "image/png"
Args(2).Name = "Overwrite"
Args(2).value = false
oFilter.filter(args())
Next i
' Enable the following line if you call macro from windows batch file '
thisComponent.Close(true)
End Sub