Re: PNG loading time

Hartmut Henkel via tex-live <[email protected]>
Newsgroups gmane.comp.tex.live
Message-ID <[email protected]>
Hi Norbert,

it's writepng.c in pdftex, which is very restrictive regarding "PNG
copy":

# any colortype:
$ convert x.ppm x.png    # PNG copy skipped because: cHRM bKGD

# colortype gray or color:
$ pnmtopng x.ppm > x.png # PNG copy

# colortype palette
$ pnmtopng x.ppm > x.png # PNG copy skipped because: colortype

When using ImageMagick convert to generate a PNG file, this tool will
add cHRM and bKGD chunks (without need?), then it's slow. Netpbm
pnmtopng does not generate these chunks, then it's fast copy.  However,
if a PNG uses a palette (e. g., less than 256 colors), then it's also
slow with pnmtopng (noticable for large PNGs), since "PNG copy" palette
(colortype 3) is not supported by writepng.c.

The code p_png.c by Thomas Merz, from which "PNG copy" was gleaned,
supports also palette and does so by added code. But this was not
implemented in writepng.c (likely due to laziness).

Now, experimentally allowing also palette for "PNG copy" without adding
special palette chunk code in writepng.c seems to produce valid PDFs
with palette info! :-) Unclear, why, risky. Adding "fast" palette copy
seems to be possible and would speed up inclusion for a large class of
PNGs. Room for improvement...

Best Regards
Hartmut
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.