From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/68729 Path: news.gmane.org!not-for-mail From: Hartmut Henkel Newsgroups: gmane.comp.tex.context Subject: Re: compresslevel and png graphics (mkiv) Date: Wed, 25 May 2011 21:54:26 +0200 (CEST) Message-ID: References: <4DDCF96A.3050703@gmx.net> <4DDD14BC.40203@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1306353283 29064 80.91.229.12 (25 May 2011 19:54:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 May 2011 19:54:43 +0000 (UTC) Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Wed May 25 21:54:38 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QPKA8-00013B-Uz for gctc-ntg-context-518@m.gmane.org; Wed, 25 May 2011 21:54:37 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 841BCCAD59; Wed, 25 May 2011 21:54:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lrqX8W+1BZHT; Wed, 25 May 2011 21:54:32 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C71D1CAD5E; Wed, 25 May 2011 21:54:32 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9D833CAD5E for ; Wed, 25 May 2011 21:54:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9PevlePKj+dP for ; Wed, 25 May 2011 21:54:28 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 9EA00CAD59 for ; Wed, 25 May 2011 21:54:28 +0200 (CEST) Original-Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with SMTP id p4PJsR5a018035 for ; Wed, 25 May 2011 21:54:28 +0200 Original-Received: (qmail invoked by alias); 25 May 2011 19:54:27 -0000 Original-Received: from mnhm-4d010120.pool.mediaWays.net (EHLO hahepc1.hahe) [77.1.1.32] by mail.gmx.net (mp046) with SMTP; 25 May 2011 21:54:27 +0200 X-Authenticated: #6218946 X-Provags-ID: V01U2FsdGVkX18L/KQfLmML5ETqDjdeOAopXIIR6Z2SWsq7e66kL+ XleluH0jsNAt9x Original-Received: from hahe (helo=localhost) by hahepc1.hahe with local-esmtp (Exim 4.72) (envelope-from ) id 1QPK9y-0000xM-MH; Wed, 25 May 2011 21:54:26 +0200 In-Reply-To: <4DDD14BC.40203@wxs.nl> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) X-Y-GMX-Trusted: 0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.165.64.22; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03ELTSr0h - 6e4af6d5de13 - 20110525 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:68729 Archived-At: 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 : ntg-context@ntg.nl / 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 ___________________________________________________________________________________