Previous Next


                                         351
SECTION 4.8                                                                     Images



Note: If image interpolation (see “Image Interpolation” on page 346) is requested
during stencil masking, the effect is to smooth the edges of the mask, not to interpo-
late the painted color values. This effect can minimize the jaggy appearance of a
low-resolution stencil mask.

Explicit Masking

In PDF 1.3, the Mask entry in an image dictionary may be an image mask, as de-
scribed above under “Stencil Masking,” which serves as an explicit mask for the
primary (base) image. The base image and the image mask need not have the
same resolution (Width and Height values), but since all images are defined on
the unit square in user space, their boundaries on the page will coincide; that is,
they will overlay each other. The image mask indicates which places on the page
are to be painted and which are to be masked out (left unchanged). Unmasked ar-
eas are painted with the corresponding portions of the base image; masked areas
are not.


Color Key Masking

In PDF 1.3, the Mask entry in an image dictionary may alternatively be an array
specifying a range of colors to be masked out. Samples in the image that fall with-
in this range are not painted, allowing the existing background to show through.
The effect is similar to that of the video technique known as chroma-key.

For color key masking, the value of the Mask entry is an array of 2 × n integers,
[ min1 max1 … minn maxn ], where n is the number of color components in the
image’s color space. Each integer must be in the range 0 to 2BitsPerComponent − 1,
representing color values before decoding with the Decode array. An image sam-
ple is masked (not painted) if all of its color components before decoding, c1 … cn ,
fall within the specified ranges (that is, if mini ≤ ci ≤ maxi for all 1 ≤ i ≤ n).

Note: When color key masking is specified, the use of a DCTDecode filter for the
stream is not recommended. DCTDecode is a lossy filter, meaning that the output is
only an approximation of the original input data. Therefore, the use of this filter can
lead to slight changes in the color values of image samples, possibly causing samples
that were intended to be masked to be unexpectedly painted instead, in colors slight-
ly different from the mask color.

Previous Next