Closed bohwaz closed 6 months ago
Your method solved my problem. I can get high-quality pngs by setting the pixel aspect ratio that meets the requirements, such as setting it to standard A4 paper size:
unoconvert --filter-options PixelWidth=2479 --filter-options PixelHeight=3508 ....
😆😆😆
Yes but if your document is in landscape, the PNG won't have the correct size.
Indeed, setting the height and width in the filter will create an image with that height and width. Pixel aspect ratios aren't really relevant. as LibreOffice deals with documents, and not images, and hence will convert an input image into a drawing, which has a page size, and then it will squeeze your document into the stated pixel size.
If you want to convert images between different formats, I would recommend imagemagick.
when you specify a width, the thumbnail should keep the aspect ratio, ImageMagick doesn't have a way of knowing the aspect ratio of the document.
No, but it knows the aspect ratio of the image you exported.
After much trial and error, I figured out (thanks to this) that you can set the exported PNG dimensions with:
But it does not respect the aspect ratio of the document. I tried using a
Resolution
option but that does not work. Setting only the width or height doesn't work either.I tried looking at LibreOffice source code but could not figure out where the PNG export options are. I found this: https://github.com/LibreOffice/core/blob/4ffea8f932cbad912863f7df668ed7090e6f1821/svx/source/unodraw/UnoGraphicExporter.cxx#L495
But none of the other options seemed to do anything.