On Thu, May 26, 2011 at 12:52 PM, Peter Rolf
Am 25.05.2011 21:54, schrieb Hartmut Henkel:
On Wed, 25 May 2011, Hans Hagen wrote:
On 25-5-2011 2:43, Peter Rolf wrote:
I just made a one pager (TEXpage) out of a big png graphic (5900x4094). The compressed size of the graphics is normally around 1.37MB on the highest png compress level (9) and 1.32MB after using optipng (only around 3% reduction this time). To my surprise the size of the final PDF was about 2.3MB. After adding '\pdfcompresslevel9' the size went down to 1.48MB. Still not what I wanted...
So I was wondering: is there an option to embed the png graphic as it is (no re-compression)?
no. There is a "PNG Copy" function for literal embedding of the PNG file, but that triggers only, if the file simultaneously satisfies quite a few conditions, which are about: non-interlaced, no palette, no transparency, no gamma coming with it, no gamma modification requested, no white adjustment in the PNG, and a few more rare others. Else it's de-compressed and then re-compressed to the \pdfcompresslevel, and additional streams and dicts are added. You see in the log if it finally was "PNG Copy" or not.
Sigh, most of my graphics use (and need) transparency. So the only advantage I get from optipng is the smaller file size on my disk. Sad, but good to know. ;-)
Preprocessing the PNG, e. g., by convert, sometimes changes it that it gets copyable. Obviously flattening transparency also helps.
Anyway direct embedding or not can have positive or negative influence on the PDF file size. E. g. if a PNG is copied verbatim, and it contains lots of meta-data info, the PDF file will probably get larger, since normal PNG embedding removes all these info chunks.
And what about icc profiles? removed, I suppose. Not really a big problem, and doable in mkiv (see Hacked image color space. in texmf-dist/doc/pdftex/manual/samplepdf of a recent texlive)
-- luigi