Convert emf to png with saving transparency

title

I am using command line to convert emf to png files, but since emf file does not have a background by default, when converting, libreoffice generates a huge white space behind the actual image. Libreoffice does have a save transparency option in the settings

but i dont see any CLI reference for this option at Graphics Export Parameters
The closest one is translucent and ExportOnlyBackground, but toggling these two parameters to true or false didn’t make any difference.

My cmd:

soffice --headless --convert-to ‘png:writer_png_Export:{“ExportOnlyBackground”: {“type”: “boolean”, “value”: “true”}, “Translucent”: {“type”: “boolean”, “value”: “true”}}’ i1.emf

any idea where went wrong?

No, but I will change your tags. It seems neither Base for Database-Module nor basic for the Macro-Language BASIC fits…
.
As you seem to use LibreOffice as a graphics converter here I’m out. I would probably tried ImageMagick or Ghostscript, not an office-suite.

hi,

thank you for your correction.

fyi, since my PC is on Linux, where ImageMagick does not support emf format, that option was ruled out.

Never used Ghostscript before, but it turns out to be a PDF-focused SDK? Not sure if that is related to my issue here.

As a result, LibreOffice is my last bet.

You could try GitHub - pzinovkin/emf: EMF images reader/converter and see if it does what you want. Web search also found High quality EMF/WMF to PNG in Linux (Example) which might also help.

hello, thank you for your reply.

Unfortunately I am working on a python project, so the GitHub project you provided probably will not work.

Regarding unoconv, since it is deprecated and i’m pretty much sure it’s fundamentally based on/related to LibreOffice, this is probably not the most desirable solution.