Change default resolution in batch PNG conversion

Hello,

I am looking for a way to change the resolution of PNG generated by libreoffice without user interaction.

Here is an example

>> echo "example of PNG conversion" > example.txt
>> libreoffice --convert-to png example.txt

>> eog example.png # eye of gnome to display the file

The image generated by libreoffice from a A4 document has only 794 x 1123 pixels.
(With 96 points per 2.54 cm, 21 x 29.7 cm is 793.7 x 1122.5, this is ok.)

I have tried with no luck several options to change the output resolution like:

>> libreoffice --convert-to png:writer_png_Export:resolution=300 example.txt

Maybe I could edit a file somewhere to change the output resolution from 96 to 300 DPI?

Thank you.
Michael

I may have found why 96 is selected by default in the code.

In: ./svtools/source/filter/GraphicExportOptionsDialog.cxx

    GraphicExportOptionsDialog::GraphicExportOptionsDialog(vcl::Window* pWindow, const Reference<XComponent>& rxSourceDocument) :
        ModalDialog(pWindow, "GraphicExporter", "svt/ui/GraphicExportOptionsDialog.ui"),
        mResolution(96.0),
        mRenderer(rxSourceDocument)
{ ...}

I do not clearly understand the syntax but mResolution(96.0) could explain why 96 is selected by default.

Update: I have replaced mResolution(96.0) by mResolution(300.0) and recompiled libreoffice.
Now 300 DPI is selected by default but only in the interactive export window.
I tried writing a macro to export file but the Export menu still requires user interaction to select export parameters.

An ugly work around is to use a pdf export and use imagemagick convert command:

echo "Example of PNG conversion" > example.txt
libreoffice --headless --convert-to pdf example.txt
convert -density 600 -trim example.pdf example.png
eog example.png