[NTG-pdftex] Expanded png inclusion support

Taco Hoekwater taco at elvenkind.com
Tue Jan 11 17:29:39 CET 2005


This is a complete, working patch, but the zip only contains the actual 
pngextra.ch and replacement writepng.c, so some manual editting has to 
be done to the Makefile. The change file needs to be added as the last
item of the "pdftex_web_srcs" collection, the C file can overwrite the
current file.

This version is for testing purposes. I can provide linux 2.6 binaries,
but I don't know how to create win32 executables, sorry.

The main part of the patch is the new writepng.c, but there is also
some web glue to set defaults. The patch contains improvements for PNG
image inclusion, specifically:

- alpha channel and transparency (only if %!PDF >=1.4)
- 16-bit colour (only if %!PDF >=1.5)
- gamma correction
- forced reduction to greyscale (for Hans)

A few primitives had to be introduced to set some default values.
There are a total of four new primitives, that are all integer 
parameters. I almost certainly made mistakes in the WEB coding
(initialization locations etc.), but works well enough for testing.

Here are  the primitives and their defaults:

   \pdfoptionpdfimagehicolor = 1
   % can be set to 0 if undesirable. This is perhaps needed because
   % the reader 5 will reject the pdf document's page completely
   % otherwise.

   \pdfimagegamma = 2200
   % if not supplied in the image. This example implies that the image
   % was originally created with gamma value 2.2 (like magnification)

   \pdfgamma = 1000
   % Gamma value for the 'pdf device'. It looks like this is the
   % 'correct' value used by Adobe, but I'm not 100% sure.

   \pdfoptionimageforcegray = 0
   % If 1, all included PNGs are written to the pdf as greyscale.

The problem with these primitives is that I am unsure how and
when to convert the internal parameters into their C 'fixedxxxxxx'
counterparts. It would be a lot cleaner if the C code would use
the internal parameters directly, but I'm not sure if that is
even possible. Help needed!

Greetings, Taco

noreply at sarovar.org wrote:
> Patches item #259, was opened at 2005-01-11 16:44
> Submitted By: Taco Hoekwater (taco)
> Summary: Expanded png inclusion support

More information about the ntg-pdftex mailing list