On 28/02/2014 12:16 pm, Cley Faye wrote:
I don't know how often this feature is requested for odt files. I know
that for pdf you can set parameters for the image compression, and it
make sense since the resulting file is unlikely to undergo future
changes, but it's less obvious for file formats that are not at the
"end" of the editing line. It's probably better to work with the
"highest" resolution needed, and produce smaller files as needed.
Fair point. However most documents reach a finished state, at which
point they do not need to stay bloated.
Hmm. As a "proof of concept", I put together a java program that take
an odt file as input. You can then set the "requested" DPI and jpeg
quality, and save. At this point, every pictures that are larger than
needed (that's why we need DPI) are resized, and all pictures are
compressed using either jpg or png, whichever gives the smalles size.
Something as simple as that already have issues, like when there's
transparency involved. Also, it's only tested on a few files
(including
https://wiki.documentfoundation.org/images/9/96/WG40-WriterGuideLO.odt
for funsies). If anyone want to give it a try here's the jar. It's
highly unlikely to corrupt your source file (the source file is never
ever written), but there's also no guarantee that the output will work
;) <http://cleyfaye.net/share/odtcompress.jar> For example, on the
writer guide linked before, it goes from 13MB to 9MB with default
settings. Of course it's not the best example: all pictures are
already reasonably sized, and it's mostly screenshots so the quality
drop is very noticeable... Anyway, if anyone want to look at the
source code (without reversing the jar :D) I'll provide them. But know
that it's mostly an ugly hack just to see how well it would work :)
Cley, a good "proof of concept". It needs lots of work but certainly as
a concept it gains my approval.
Dale.
--------
Email from setec.com.au does not necessarily represent the official
policy of SETEC Pty Ltd.
See http://www.setec.com.au/emaildisclaimer20060629.html for details.
--
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted