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. 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. Another factor influencing the size is if it's PDF-1.4 or PDF-1.5: If you have a 16 bit PNG, for PDF-1.4 it will be automatically reduced to 8 bit by luatex and pdftex, so suddenly the PDF file gets smaller, but actually also the image quality (silently) went down. These are about the factors affecting the PNG to PDF size. For your big PNG graphic you may find a preprocessing (e. g., pngtopnm | pnmtopng will definitely remove all fat) that makes it compliant with the "PNG copy". > Otherwise the time consuming usage of optipng would be a complete > waste of time. Believe it or not, but size matters :-) yes :-) > This one is for Hartmut to answer. Keep in mind that pdf does support > pgn and jpg compression, which is not the same as 'inclusion as-is'. fwiw, jpg is always embedded literally (no re-compression). > The compresslevel concerns copyright free zip compression of streams > (that can happen to gave image data). Regards, Hartmut ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
