ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: compresslevel and png graphics (mkiv)
Date: Thu, 26 May 2011 12:52:00 +0200	[thread overview]
Message-ID: <4DDE30D0.9040204@gmx.net> (raw)
In-Reply-To: <alpine.DEB.2.00.1105252131580.3593@hahepc1.hahe>

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?

> 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".
>
I will give that a try. But I doubt that there is much 'fat' on that
graphic. Anyhow, you never know before you have tried it. :-)

Thanks Hartmut for the very detailed and interesting answer.

Regards, Peter

>> 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
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2011-05-26 10:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 12:43 Peter Rolf
2011-05-25 14:39 ` Hans Hagen
2011-05-25 14:48   ` Taco Hoekwater
2011-05-25 16:05     ` Peter Rolf
2011-05-25 19:54   ` Hartmut Henkel
2011-05-26 10:52     ` Peter Rolf [this message]
2011-05-26 11:22       ` luigi scarso
2011-05-26 16:17       ` Peter Rolf
2011-05-27 11:57         ` Peter Rolf
2011-05-27 13:09           ` Hartmut Henkel
2011-05-27 15:11             ` Peter Rolf
2011-05-27 15:19               ` luigi scarso
2011-05-27 15:34                 ` Peter Rolf
2011-05-25 14:40 ` Hans Hagen
2011-05-26 17:32   ` mathew
2011-05-26 17:43     ` mathew
2011-05-27  6:17       ` Henning Hraban Ramm
2011-05-27  7:43         ` Hans Hagen
2011-05-26 17:55     ` mathew
2011-05-26 17:58   ` Martin Schröder
2011-05-26 22:52   ` George N. White III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDE30D0.9040204@gmx.net \
    --to=indiego@gmx.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).