Bug 157668 - Allow passing parameters to graphic export filters
Summary: Allow passing parameters to graphic export filters
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Oscar65
URL:
Whiteboard: target:26.2.0
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2023-10-09 15:11 UTC by Mike Kaganski
Modified: 2025-06-17 07:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-10-09 15:11:54 UTC
Since LibreOffice v.7.4, there is a way to pass any filter option available for PDF export, from the command line [1], [2].

The commit that enabled that was 0c3b8792b712e939d2ad524d554f96616b4844be.

Currently there is no way to pass e.g. dimensions, or resolution, or other parameters to the graphic export (PNG/JPEG/etc.) from the command line, because a command line like

> soffice --convert-to png:writer_png_Export:params_here example.odt

will pass the string "params_here" into the respective filter inside a property called "FilterOptions", while the filter only uses a property named "FilterData", which must be a sequence of beans::PropertyValue. See GraphicExportFilter::gatherProperties.

The idea is to implement a similar processing of FilterOptions in the gatherProperties, as implemented in the abovementioned commit for PDF. The syntax of the passed parameters should be the same as for the PDF, i.e. a JSON structure like

> soffice --convert-to 'png:writer_png_Export:{"PixelWidth":{"type":"long","value":"200"},"PixelHeight":{"type":"long","value":"100"}}' example.odt

[1] https://vmiklos.hu/blog/pdf-convert-to.html
[2] https://help.libreoffice.org/latest/en-US/text/shared/guide/pdf_params.html?DbPAR=SHARED
Comment 1 V Stuart Foote 2023-10-09 18:15:48 UTC
useful enhancement, +1
Comment 2 Oscar65 2025-06-09 09:18:17 UTC
I upload commit https://gerrit.libreoffice.org/c/core/+/186287 with upgrade to allow to pass parameters to graphic export filters.
Comment 3 Commit Notification 2025-06-17 06:37:32 UTC
Oscar Megía López committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/323598a6845bd8b4046689816a7d535385c23a19

tdf#157668 Upgrade to pass options to --convert-to

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Buovjaga 2025-06-17 07:11:43 UTC
Oscar: feel free to change the status as resolved fixed.