CHAPTER 4
336
Graphics
Note:
For convenience, the following sections refer consistently to the object defining
an image as an
image dictionary.
Although this term properly refers only to the
dictionary portion of the stream object representing an image XObject, it should be
understood to apply equally to the stream’s data portion or to the parameters and
data of an inline image.
4.8.2 Sample Representation
The source format for an image can be described by four parameters:
•
The width of the image in samples
•
The height of the image in samples
•
The number of color components per sample
•
The number of bits per color component
The image dictionary specifies the width, height, and number of bits per compo-
nent explicitly. The number of color components can be inferred from the color
space specified in the dictionary.
Note:
For images using the
JPXDecode
filter (see Section 3.3.8, “JPXDecode Filter”),
the number of bits per component is determined from the image data and not speci-
fied in the image dictionary. The color space may or may not be specified in the dic-
tionary.
Sample data is represented as a stream of bytes, interpreted as 8-bit unsigned
integers in the range 0 to 255. The bytes constitute a continuous bit stream, with
the high-order bit of each byte first. This bit stream, in turn, is divided into units
of
n
bits each, where
n
is the number of bits per component. Each unit encodes a
color component value, given with high-order bit first; units of 16 bits are given
with the most significant byte first. Byte boundaries are ignored, except that each
row of sample data must begin on a byte boundary. If the number of data bits per
row is not a multiple of 8, the end of the row is padded with extra bits to fill out
the last byte. A PDF consumer application ignores these padding bits.
Each
n-bit
unit within the bit stream is interpreted as an unsigned integer in the
range 0 to 2
n
−
1, with the high-order bit first. The image dictionary’s
Decode
entry maps this integer to a color component value, equivalent to what could be
used with color operators such as
sc
or
g
. Color components are interleaved sam-