Re: Slow PNG inclusion with pdfLaTeX
Hartmut, I saw this on c.t.t. Shall I attempt a merge of yours and my patches? Taco Hartmut Henkel wrote:
wrote: I need to put a lot of PNG pictures in a tex document. But including PNGs makes pdfLaTeX to hang a few seconds after including each PNG. This doen't happens with other file types as JPG, PDF, etc.
Is there a way to ommit this delay? Without converting all PNGs to other format?
If you compile from source, maybe check
http://www.circuitwizard.de/pdftex/patch5
which should read much faster, if the PNG files are of the right type. The problem with this rough patch is that it's now getting obsolete as it doesn't (yet) support new transparency features to come.
Regards, Hartmut
Hi Taco, On Sun, 27 Feb 2005, Taco Hoekwater wrote:
I saw this on c.t.t. Shall I attempt a merge of yours and my patches?
oh yes, that would be very nice! The reason why i hesitated with this patch is that it's not clear to me whether the libpng internally does any color transforms or other RGB number tweaking during decompression, maybe driven by some special PNG chunks in the image file. The fast reading patch would ignore these chunks. But until now i couldn't verify that libpng would do such calculations at all. Likely not; then the patch would be safe. Regards, Hartmut
Hartmut Henkel wrote:
wrote: I need to put a lot of PNG pictures in a tex document. But including PNGs makes pdfLaTeX to hang a few seconds after including each PNG. This doen't happens with other file types as JPG, PDF, etc.
Is there a way to ommit this delay? Without converting all PNGs to other format?
If you compile from source, maybe check
http://www.circuitwizard.de/pdftex/patch5
which should read much faster, if the PNG files are of the right type. The problem with this rough patch is that it's now getting obsolete as it doesn't (yet) support new transparency features to come.
Hi, I just uploaded a new patch version (twice, sorry). I felt had to introduce a new primitive \pdfoptionimageapplygamma = <0,1,2> because otherwise almost all images would be rejected because of gamma processing. Values: 0 - never do gamma, i.e. same as versions < 1.21a 1 - only do gamma if it would not break fast reading 2 - always do gamma In order to be acceptable for native copying, the following constraints must be met: * minor pdf version must be at least 2 * gray conversion must not be needed. * if apply gamma is "2", the 'gamma delta' must be near zero * the image file format must not be interlaced * the color bit depth must be 8 or less, unless pdf minor is >=5 * the image may not have an alpha channel nor 'gif' transparancy. The test suite (the variant I use) gives me 78 native file inclusions with values 0 or 1 for 'apply gamma', and 54 files with value 2 in 8bit color mode; (these numbers are resp. 98 and 69 in 16bit color mode). Of course I also ran a speed test: $ ls -l hellhuge.png -rw-r--r-- 1 taco users 12639474 Feb 28 15:23 hellhuge.png $ ./pngcheck hellhuge.png OK: hellhuge.png (5120x5120, 24-bit RGB, non-interlaced, 83.9%). $ time pdfetex \&cont-en fasthuge.tex Output written on fasthuge.pdf (1 page, 12626572 bytes). Transcript written on fasthuge.log. 0.31user 0.27system 0:02.27elapsed 25%CPU $ time pdfetex \&cont-en slowhuge.tex Output written on slowhuge.pdf (1 page, 25379598 bytes). Transcript written on slowhuge.log. 25.86user 1.58system 0:34.68elapsed 79%CPU Greetings, Taco Hartmut Henkel wrote:
Hi Taco,
On Sun, 27 Feb 2005, Taco Hoekwater wrote:
I saw this on c.t.t. Shall I attempt a merge of yours and my patches?
oh yes, that would be very nice! The reason why i hesitated with this patch is that it's not clear to me whether the libpng internally does any color transforms or other RGB number tweaking during decompression, maybe driven by some special PNG chunks in the image file. The fast reading patch would ignore these chunks. But until now i couldn't verify that libpng would do such calculations at all. Likely not; then the patch would be safe.
Regards, Hartmut
Hi Taco, On Mon, 28 Feb 2005, Taco Hoekwater wrote:
I just uploaded a new patch version (twice, sorry). I felt had to introduce a new primitive
you did it :-) thanks a lot! Trying out... Here it hangs with pdftexdir/libpdf.a(writepng.o): In function `read_png_info': /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:50: undefined reference to `fixedimageapplygamma' /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:52: undefined reference to `fixedgamma'... Do you have any idea what i'm missing? E. g. don't i need some getintpar()?
Of course I also ran a speed test:
$ ls -l hellhuge.png -rw-r--r-- 1 taco users 12639474 Feb 28 15:23 hellhuge.png $ ./pngcheck hellhuge.png OK: hellhuge.png (5120x5120, 24-bit RGB, non-interlaced, 83.9%).
$ time pdfetex \&cont-en fasthuge.tex Output written on fasthuge.pdf (1 page, 12626572 bytes). Transcript written on fasthuge.log. 0.31user 0.27system 0:02.27elapsed 25%CPU
$ time pdfetex \&cont-en slowhuge.tex Output written on slowhuge.pdf (1 page, 25379598 bytes). Transcript written on slowhuge.log. 25.86user 1.58system 0:34.68elapsed 79%CPU
this last one is not recompressed? Regards, Hartmut
On Mon, 28 Feb 2005, Hartmut Henkel wrote:
you did it :-) thanks a lot! Trying out... Here it hangs with
pdftexdir/libpdf.a(writepng.o): In function `read_png_info': /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:50: undefined reference to `fixedimageapplygamma' /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:52: undefined reference to `fixedgamma'...
Ooops, this was with pdfxtex, sorry, which isn't so straight-forward due to the other patches already there. I have now thrown out pdfxtex from the Makefile and it compiles... Regards, Hartmut
I had problems as well. The builds for pdfxtex and pdfetex read the pdftexd.h file that is autogenerated, *not* pdfxtexd.h or pdfetexd.h, as they should. Didn't know how to fix so I just added the change file to all three :-) Taco Hartmut Henkel wrote:
On Mon, 28 Feb 2005, Hartmut Henkel wrote:
you did it :-) thanks a lot! Trying out... Here it hangs with
pdftexdir/libpdf.a(writepng.o): In function `read_png_info': /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:50: undefined reference to `fixedimageapplygamma' /usr/local/src/tex/teTeX/tetex-src-3.0/texk/web2c/pdftexdir/writepng.c:52: undefined reference to `fixedgamma'...
Ooops, this was with pdfxtex, sorry, which isn't so straight-forward due to the other patches already there. I have now thrown out pdfxtex from the Makefile and it compiles...
Regards, Hartmut _______________________________________________ ntg-pdftex mailing list ntg-pdftex@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-pdftex
participants (3)
-
Hartmut Henkel
-
Taco Hoekwater
-
Taco Hoekwater