AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

2009.01.16 17:29 "[Tiff] tiff2ps option -m for imagemask operator", by Richard Nolde

Regarding invalid Postscript produced by tiff2ps when the -m flag is used.

I have narrowed the problem down to the case where the -m option is used without -2 or -3. The current code calls PSpage on each image and that code begins as follows:

void PSpage(FILE* fd, TIFF* tif, uint32 w, uint32 h)
{
char * imageOp = "image";
if ( useImagemask && (bitspersample == 1) )
imageOp = "imagemask";
if ((level2 || level3) && PS_Lvl2page(fd, tif, w, h))
return;

There is no PS_LVL1page function in tiff2ps.c so there no special handling for useImagemask even though according to an online reference source, the imagemask operator is handled differently for Level1 and Level2.

imagemask
width heigh polarity matrix datasrc imagemask -
dict imagemask -

uses a monochrome sampled image as a stencil mask of 1-bit samples to control where to apply paint to the current page in the current color (see “Stencil Masking”on page 302.)In the first form of the operator (LanguageLevel 1), the parameters are specified as separate operands. In the second form (LanguageLevel 2), the parameters are contained as entries in an image dictionary dict, which is supplied as the single operand.The behavior of the operator is the same in both forms.imagemask uses the width, height, matrix, and datasrc operands in precisely the same way the image operator uses them.

I have a patch to disallow -m without -2 or -3.

Richard Nolde