Exporting high quality PNG from LibreOffice Draw

5

2

I need to generate a PNG file of an image composed in LibreOffice Draw. When I export to PNG directly, the quality is almost perfect, but it's just slightly blurry. However, when I export directly to a PDF with lossless compression, the quality is perfect --- just not in PNG format.

The dimensions of the image are 495x304. Whenever I try to convert the "perfect" PDF file to a high-quality PNG file, the PNG file at 100% magnification (as viewed in evince) is about 2-3 times larger than the image in the PDF file. Or, when I get the PDF converted to PNG at approximately the correct dimensions, the PNG file is too sharp.

I have tried commands like this

gs -sDEVICE=pngalpha -sOutputFile=new.png -r144 image.pdf

and

convert -quality 100 -density 300 image.pdf new.png

But neither command renders a PNG with quality as good as the PNG that can be directly exported to in LibreOffice Draw.

So, my question is how to do either of the following: (1) export to better quality PNG directly from LibreOffice Draw; or (2) convert the perfect quality PDF to PNG with comparable quality and same dimensions.

And here are the export settings I'm using when exporting directly to PNG: enter image description here

synaptik

Posted 2013-12-11T01:38:00.710

Reputation: 265

1I don't see how this is related with programming. – leonbloy – 2013-12-11T03:07:32.190

You're right. I saw some similar posts in SO about using imagemagick to convert PDF to PNG, and originally my post was less about LibreOffice Draw, and more about Linux utilities for conversion. But even then, you're right, not appropriate for SO. – synaptik – 2013-12-11T14:05:51.660

As for (2), please take a look at this Q&A

– Glutanimate – 2013-12-11T16:17:09.850

@Glutanimate Thanks. I tried Inkscape, and it was pretty good. – synaptik – 2013-12-12T23:07:38.153

1@Glutanimate Oddly enough, I found that the best solution in my case was to simply use a standard screenshot tool and take a "snap" of the PDF. – synaptik – 2013-12-12T23:08:57.927

Answers

4

There is something off about the Export tool of LibreOffice in general. It has been years, and it is sill broken. An alternative is just taking screen shot, but obviously you cannot control de resolution.

So a better work around is exporting to SVG, and then convert the SVG to PNG with Inkscape. Once download it, you can convert the file with the following command:

inkscape -z -e out.png -w 1024 in.svg

If you are in Windows (x64), you ll need to put the full path

"C:/Program Files/Inkscape/inkscape.exe" -z -e out.png -w 1024 in.svg 

If you install the 32 bit version, this should work:

"C:\Program Files (x86)/Inkscape/inkscape.exe" -z -e out.png -w 1024 in.svg 

Hope it helps somebody

toto_tico

Posted 2013-12-11T01:38:00.710

Reputation: 471

1

I know that maybe is not the best solution, but if you are looking for a GUI to do so, I think an alternative is open the PDF file in GIMP, then appears a dialog asking details about DPI import and how many pages do you want to import, then export to PNG, save... done :D

Is so simple, i hope this helps someone.

Lyoneel

Posted 2013-12-11T01:38:00.710

Reputation: 121

Thanks for reminding GIMP. Inspired by your solution, I found that exported from LibreOffice to SVG keeps perfect alpha transparency. Then open it in GIMP, then do what you like. – jmgonet – 2019-06-04T05:45:36.380