8. Mixed Raster Content Mode
This section defines the Mixed Raster Content mode or Profile M of
TIFF for facsimile. Implementations of this profile are required to
implement Profiles S and C, and may optionally implement Profiles F,
J and L.
8.1. Overview
Unlike previous fax modes, which use a single coding method and
spatial resolution for an entire fax page, the Mixed Raster Content
mode [T.44] enables different coding methods and resolutions within a
single page. For example, consider a page that contains black-and-
white text, which is best coded with MMR or JBIG, a color bar chart,
best coded with JBIG, and a scanned color image, best coded with
JPEG. Similarly, while spatial resolution of 400 pixels per inch may
be best for the black-and- white text, 200 pixel per inch is usually
sufficient for a color image.
Rather than applying one coding method and resolution to all
elements, MRC allows multiple coders and resolutions within a page.
By itself, MRC does not define any new coding methods or resolutions.
Instead it defines a 3-layer image model for structuring and
combining the scanned image data. The MRC 3-layer model has been
applied here using the TIFF format to yield a data structure which
differs from [T.44] though it applies the same coding methods, uses
the same compressed image data stream and is consistent with the TIFF
principle of a single IFD per image.
8.1.1. MRC 3-layer model
The 3 layers of the MRC model are Foreground and Background, which
are both multi-level, and Mask, which is bi-level. Each layer may
appear only once on a page and is coded independently of the other
two. In our earlier example, the black-and-white text could be in the
Mask layer, the color chart in the Foreground layer, and the color
image in the Background layer.
Each layer is an image and, when present, is represented by at least
one IFD in a TIFF file. This is consistent with TIFF, which provides
fields to define the attributes, such as resolution, image size, bits
per sample, etc., of a single image or layer. The distribution of
content among layers is determined by the writer, as is the choice of
coding method, color encoding and spatial resolution for a layer.
The final image is obtained by using the Mask layer to select pixels
from the other two layers. When the Mask layer pixel value is 1, the
corresponding pixel from the Foreground layer is selected; when it is
0, the corresponding pixel from the Background layer is selected.
Details are given in the Introduction of [T.44].
Not all pages, and not all parts of a page, require 3 layers. If
there is only one layer present, then that layer is the primary image
or IFD. If there is more than one layer, then the Mask must be one of
the layers, in which case it is the primary image and it must be page
size.
MRC allows a page to be split into strips, with a variable number of
scanlines in a strip. A strip can have 1, 2 or 3 layers. A single,
stripped layer may be stored as a single, stripped image in an IFD,
e.g., all strips associated with the Background layer may be treated
as a single image. Alternatively, each strip associated with a layer
may be stored as a separate image or IFD, e.g., the Background layer
can be composed of several images that are offset vertically with
respect to the page. In this case, there can be no overlap between
images associated with a single layer. According to [T.4] Annex G,
strips having more than 1 layer SHOULD NOT be more than 256 lines in
length unless the capability to receive longer strips has been
negotiated.
Furthermore, color fax also requires the spatial resolutions of
Background and Foreground images to be legal fax values that are also
integer factors of the Mask image resolution. For example, if the
Mask Layer resolution is 400 pixels per inch, then allowed
resolutions for the Foreground and Background layers are 100, 200 or
400 pixels per inch; if the Mask is at 300 pixels per inch, then
allowed values are 100 and 300. The Foreground and Background layer
resolutions can be independently set.
8.1.2. A TIFF Representation for the MRC 3-layer model
In the TIFF representation of the 3-layer MRC model, each page is
represented by a single IFD, called the Primary IFD, that represents
the Mask layer (unless the Foreground or Background is the single
layer present), and a set of child IFDs that are referenced through
the SubIFDs extension field [TTN1]. To distinguish MRC-specific
SubIFDs from other SubIFDs, the NewSubFileType field MUST have Bit 4
ON, indicating an MRC-related IFD. A new ImageLayer field is also
introduced that consists of two values that identify the layer
(Foreground, Background, or Mask) and the order within the layer
(first, second, ... image of the layer); see Section 8.2.3.
Because MRC allows strips with variable numbers of scanlines, a
reader MUST support StripRowCounts field because a writer may use it
in place of the RowsPerStrip field in this mode. The StripRowCounts
field allows each layer, with a variable number of scanlines in each
strip, to be represented by a single IFD, when the coding parameters
are the same for all strips in the layer. The MRC standard [T.44]
allows the Foreground and Background layers to have strips with
different coding parameters. In this case, a separate IFD is required
to represent the strips which use different coding parameters; see
text in next paragraph. In all cases, the Mask layer is required to
be represented by a single IFD and a single set of coding parameters.
The use of SubIFDs to store child IFDs is described in [TTN1]. An
example is shown graphically below. The Primary IFD associated with
page 1 (PrimaryIFD 0) points to page 2 (PrimaryIFD 1) with the
nextIFD offset. The Primary IFD, corresponding to the Mask layer
(ImageLayer=[2,1]), contains a SubIFDs field that points to a list of
child IFDs. The first child IFD represents one image of the
Background layer, i.e., ImageLayer=[1,1]. This child IFD points to
the second child IFD via the nextIFD offset. This child represents
the second Background layer image, ImageLayer=[1,2]. Finally, the
second child points to the third child, which corresponds to the
single Foreground layer image, ImageLayer=[3,1]. The next IFD offset
associated with this Foreground image is 0, indicating no more child
IFDs exist. Each primary IFD has the NewSubFileType set to 18,
indicating the IFD is MRC-specific (bit 4) and that it is a single
page of a multi-page document (bit 1). Each child IFD has the
NewSubFileType set to 16, indicating the IFD is MRC-specific. The 'V'
character should be read as a down-pointing arrow.
(nextIFD)
PRIMARY IFD 0 ------------> PRIMARY IFD 1--> ...
ImageLayer = [2,1]
NewSubFileType = 18
SubIFDs
|
V
Child IFD
ImageLayer = [1,1]
NewSubFileType = 16
|
|(nextIFD)
|
V
Child IFD
ImageLayer = [1,2]
NewSubFileType = 16
|
|(nextIFD)
|
V
Child IFD
ImageLayer = [3,1]
NewSubFileType = 16
|
|(nextIFD)
V
0
In the example above, the SubIFDs field of the Primary IFD points to
the first IFD in a list of child IFDs. TIFF allows the SubIFDs field
to point to an array of IFDs, each of which can be the first of a
list of IFDs. An MRC-enabled TIFF reader must scan all available
child IFDs to locate and identify IFDs associated with MRC layers.
In the case where the Background or Foreground layers are described
with multiple IFDs, the XPosition and YPosition TIFF fields specify
the offset to the upper-left corner of the IFD with respect to the
Mask layer; see Section 8.2.2. When there is only a single layer
(Mask, Foreground, or Background), it is stored as the Primary IFD.
8.2. Required TIFF Fields
This section describes the TIFF fields required, in addition to those
in Section 2.2.1, to represent MRC mode fax images. Since MRC mode
stores fax data as a collection of images corresponding to layers or
parts of layers, the coding methods, color encodings and spatial
resolutions used by previous modes apply to MRC. Therefore, the
descriptions here will typically reference the appropriate earlier
section. Fields and values specific to MRC mode are pointed out.
8.2.1. Baseline Fields
ImageWidth(256). SHORT or LONG
Same page widths as the base color mode; see Section 6.2.1.
In the MRC mode, the width of a Foreground or Background image in
the coded data stream may be less than the page width. In this case,
the image width in the coded data steam is used to interpret the
coded data, and the value of this field is used as the page width.
NewSubFileType(254) = 16, 18. LONG
For MRC fax mode, the NewSubFileType field has two bits that are
required.
Bit 1 indicates a single page of a multi-page document and must be
set for the Primary IFD;
Bit 4 indicates MRC imaging model as described in ITU-T
Recommendation T.44 [T.44], and must be set for Primary IFDs
and all MRC-specific child IFDs.
BitsPerSample(258) = 1, 2-8, 9-16 SHORT
Compression(259) = 3, 4, 7, 9, 10. SHORT
SamplesPerPixel(277) = 1, 3, 4. SHORT
FillOrder(266) = 1 , 2. SHORT
RequiredByTIFFBaseline
Profile F readers must be able to read data in both bit orders,
but the vast majority of facsimile products store data LSB
first, exactly as it appears on the telephone line.
1 = Most Significant Bit first.
2 = Least Significant Bit first
ResolutionUnit(296) = 2, 3. SHORT
PhotometricInterpretation(262) = 0, 1, 2, 5, 10. SHORT
For Mask layer, see Sections 4.2.1 and 5.2.1.
For Foreground and Background layers, see Sections 6.2.1 and 7.2.1.
ColorMap(320). SHORT
Count = 3 * (2**BitsPerSample)
Used when Foreground or Background layer is a palette-color image;
see Section 7.2.1.
XResolution(282) = 100, 200, 300, 400. RATIONAL
YResolution(283) = 100, 200, 300, 400. RATIONAL
The resolution of the image is expressed in pixels per resolution
unit. In pixels per inch, allowed XResolution values for all layers
are: 100, 200, 300, and 400. MRC color fax mode requires the pixels
to be square, hence YResolution must equal XResolution for all
layers. The resolution of Background and Foreground layers must each
be an integer factor of the Primary image, which is the Mask layer,
when it is present; see Section 8.4.
See Section 2.2.2 for inch-metric equivalency.
8.2.2. Extension Fields
ChromaSubSampling(530). SHORT
ChromaPositioning(531). SHORT
For Foreground and Background layers, see Section 6.2.2.
Indexed(346) = 0, 1. SHORT
For Foreground and Background layers: 1 indicates a palette-color
image, see Section 7.2.2.
T4Options(292) = 0, 1, 4, 5. SHORT
T6Options(293) = 0. SHORT
For Mask layer, see Section 4.2.2.
SubIFDs(330). IFD
Count = number of child IFDs
Each value is an offset from the beginning of the TIFF file to a
child IFD [TTN1].
XPosition(286). RATIONAL
YPosition(287). RATIONAL
Specifies the horizontal and vertical offsets of the top-left of the
IFD from the top-left of the Primary IFD in page resolution units.
For example, if the Primary IFD is at 400 pixels per inch, and a
foreground layer IFD is at 200 pixels per inch and located at pixel
coordinate (345, 678) with respect to the Primary IFD, the XPosition
value is 345/400 and the YPosition value is 678/400.
Color fax does not currently allow overlap of any component images
within a single layer.
Default values for XPosition and YPosition are 0.
8.2.3. New Fields
Decode(433). SRATIONAL
For Foreground and Background layers, see Section 6.2.3.
DefaultImageColor(434). SHORT
Count = SamplesPerPixel
In areas where no image data is available, a default color is needed
to specify the color value. If the StripByteCounts value for a strip
is 0, then the color for that strip must be defined by a default
image color.
The DefaultImageColor field uses the same encoding as the image
data, and its value is therefore interpreted using the
PhotometricInterpretation, SamplesPerPixel, BitsPerSample, and
Indexed fields. If the fax data stream requires a different
encoding, then transferring the default color value between a TIFF
file and fax data stream requires a color conversion.
For the Foreground layer image, the default value for the
DefaultImageColor field is black. For other cases, including the
Background layer image, the default value is white.
StripRowCounts(559). LONG
Count = number of strips
The number of scanlines stored in a strip. MRC allows each fax strip
to store a different number of scanlines. For strips with more than
one layer there is a maximum strip size of 256 scanlines or full
page size. The 256 maximum SHOULD be used unless the capability to
receive longer strips has been negotiated. This field replaces
RowsPerStrip for IFDs with variable-sized strips. Only one of the
two fields, StripRowCounts and RowsPerStrip, may be used in an IFD.
ImageLayer (34732). SHORT or LONG.
Count = 2
Image layers are defined such that layer 1 is the Background layer,
layer 3 is the Foreground layer, and layer 2 is the Mask layer,
which selects pixels from the Background and Foreground layers. The
ImageLayer tag contains two values, describing the layer to which
the image belongs and the order in which it is imaged.
ImageLayer[0] = 1, 2, 3.
1: Image is a Background image, i.e., the image that will appear
whenever the Mask contains a value of 0. Background images
typically contain low-resolution, continuous-tone imagery.
2: Image is the Mask layer. In MRC, if the Mask layer is present, it
must be the Primary IFD and be full page in extent (no gaps.)
3: Image is a Foreground image, i.e., the image that will appear
whenever the Mask contains a value of 1. The Foreground image
generally defines the color of text or lines, but may also
contain high-resolution imagery.
ImageLayer[1]:
1: first image to be imaged in this layer,
2: second image to be imaged in this layer,
3: ...
Value describing the image order. In MRC, this may be considered
the strip number. Since MRC mode currently does not allow overlap
between images within a layer, the order value does not have any
visual effect.
In MRC fax mode, it is possible that only a single layer is
transmitted. For example, if a page contains only a single
continuous-tone photograph, then only the Background layer may be
transmitted. In this case, the Background layer will be stored as the
Primary IFD. ImageLayer[0] will be 1 indicating Background;
ImageLayer[1] will be 1 since there can be no other IFDs associated
with that layer. No Mask layer will exist.
8.3. Recommended TIFF Fields
See Sections 2.2.3. and 2.2.4.
8.4. Rules and Requirements for Images
The MRC mode defines a fundamental set of rules for images in the 3-
layer representation.
1. If more than one layer exists, then the binary Mask layer SHALL be
present and be the primary image. The Mask layer SHALL support the
encoding defined in Section 3 and MAY support the encodings
defined in Sections 4 and 5. If only one layer exists, then the
image corresponding to that layer is the primary image.
2. When the binary Mask layer is the Primary IFD, the Primary IFD
defines and extends to the entire page boundary; all attached
model images cannot extend beyond the Primary image. Resolution
differences may cause some pixels to "hang over" the page
boundary, but no new pixels should exist completely beyond the
page extent. When the Foreground or Background layer is the
Primary IFD, the Primary IFD may not be page width.
3. The Background and Foreground images SHALL support the color
encoding defined in Section 6 and MAY support the color encoding
defined in Section 7. These images MAY optionally cover only a
portion of the strip or page.
4. Each Primary IFD and each MRC-specific SubIFD must have an
ImageLayer field to specify which layer the IFD belongs to, and
the imaging order of that IFD within the layer.
5. Each Primary IFD must have a NewSubFileType field value set to 18,
indicating a single page of a multi-page document (bit 1) and MRC
mode (bit 4).
6. Each MRC-specific child IFD must have a NewSubFileType field value
set to 16, indicating MRC mode (bit 4).
7. In MRC mode, each layer is transmitted as a sequence of strips. It
is possible that each strip of each layer can be stored as a
separate IFD. In this case, the SubIFDs structure pointed to by
the Primary IFD will contain several IFDs that have an ImageLayer
field with the layer identified as either Background (layer 1) or
Foreground (layer 3). There may be no overlap in the vertical
direction between IFDs associated with a single layer, although
there may be a gap from one of these images to the next. The TIFF
XPosition and YPosition fields are used to indicate the placement
of these images with respect to the primary image.
8. When the Mask image is present, the resolution of Background and
Foreground images must each be an integer factor of the Mask
image. For example, if the Mask image is 400 pixels/inch, then the
Background or Foreground image may be at 400 pixels/inch (400/1),
200 pixels/inch (400/2) or 100 pixels/inch (400/4).
8.5. MRC Fax Mode Summary
Recommended fields are shown with an asterisk *
+------------------+-----------------------------------------+
| Baseline Fields | Values |
|------------------|-----------------------------------------|
| BitsPerSample | 1: binary mask |
| | 8: 8 bits per color sample |
| | 9-16: optional 12 bits/sample |
+------------------+-----------------------------------------+
| ColorMap | n: LAB color map |
+------------------+-----------------------------------------+
| Compression | 3: Modified Huffman and Modified Read |
| | 4: Modified Modified Read |
| | 7: JPEG |
| | 9: JBIG, per T.85 |
| | 10: JBIG, per T.43 |
+------------------+-----------------------------------------+
| DateTime* | {ASCII): date/time in the 24-hour format|
| | "YYYY:MM:DD HH:MM:SS" |
+------------------+-----------------------------------------|
| FillOrder** | 1: Most significant bit first |
| | 2: Least significant bit first |
+------------------+-----------------------------------------|
| ImageDescription*| {ASCII}: A string describing the |
| | contents of the image. |
+------------------+-----------------------------------------+
| ImageWidth | 864, 1024, 1216, 1728**, 2048, 2432, |
| | 2592, 3072, 3456, 3648, 4096, 4864 |
+------------------+-----------------------------------------+
| ImageLength** | n: total number of scanlines in image |
+------------------+-----------------------------------------+
| NewSubFileType | 16, 18: |
| | Bit 1 indicates single page of a multi- |
| | page document on Primary IFD |
| | Bit 4 indicates MRC model |
+------------------+-----------------------------------------+
+------------------+-----------------------------------------+
| Orientation | 1**-8, Default 1 |
+------------------+-----------------------------------------+
| PhotometricInter | 0: WhiteIsZero |
| pretation | 1: BlackIsZero |
| | 2: RGB |
| | 5: CMYK |
| | 10: ITULAB |
+------------------+-----------------------------------------+
| ResolutionUnit | 2: inch |
| | 3: centimeter |
+------------------+-----------------------------------------+
| RowsPerStrip | n: number or scanlines per strip |
+------------------+-----------------------------------------+
| SamplesPerPixel | 1: L* (lightness) |
| | 3: RGB, LAB, CMY |
| | 4: CMYK |
+------------------+-----------------------------------------+
| Software* | {ASCII}: name & release number of |
| | creator software |
+------------------+-----------------------------------------+
| StripByteCounts | <n>: number or bytes in each strip |
+------------------+-----------------------------------------+
| StripOffsets | <n>: offset from beginning of file to |
| | each TIFF strip |
+------------------+-----------------------------------------|
| XResolution | 100, 200, 300, 400 (written in |
| | pixels/inch) |
+------------------+-----------------------------------------|
| YResolution | equal to XResolution (pixels must be |
| | square) |
+------------------+-----------------------------------------+
| Extension Fields |
+------------------+-----------------------------------------+
| T4Options | 0: required if Compression is Modified |
| | Huffman, EOLs not byte aligned |
| | 1: required if Compression 2D Modified |
| | Read, EOLs are not byte aligned |
| | 4: required if Compression Modified |
| | Huffman, EOLs byte aligned |
| | 5: required if Compression 2D Modified |
| | Read, EOLs are byte aligned |
+------------------+-----------------------------------------+
| T6Options | 0: required if Compression is 2D |
| | Modified Modified Read |
+------------------+-----------------------------------------+
+------------------+-----------------------------------------+
| DocumentName* | {ASCII}: name of scanned document |
+------------------+-----------------------------------------+
| PageNumber | n,m: page number followed by total page |
| | count |
+------------------+-----------------------------------------+
| ChromaSubSampling| (1,1), (2, 2)** |
| | (1, 1): equal numbers of lightness and |
| | chroma samples horizontally & vertically|
| | (2, 2): twice as many lightness samples |
| | as chroma horizontally and vertically |
+------------------+-----------------------------------------+
| ChromaPositioning| 1: centered |
+------------------+-----------------------------------------+
| Indexed | 0: not a palette-color image |
| | 1: palette-color image |
+------------------+-----------------------------------------+
| SubIFDs | <IFD>: byte offset to fg/bg IFDs |
+------------------+-----------------------------------------+
| XPosition | horizontal offset in primary IFD |
| | resolution units |
+------------------+-----------------------------------------+
| YPosition | vertical offset in primary IFD |
| | resolution units |
+------------------+-----------------------------------------+
| New Fields |
+------------------+-----------------------------------------+
| Decode | minL, maxL, mina, maxa, minb, maxb: |
| | minimum and maximum values for L*a*b* |
+------------------+-----------------------------------------+
| DefaultImageColor| <n>: background color |
+------------------+-----------------------------------------+
| StripRowCounts | <n>: number of scanlines in each strip |
+------------------+-----------------------------------------+
| ImageLayer | n, m: layer number, imaging sequence |
| | (e.g., strip number) |
+------------------+-----------------------------------------+
| GlobalParameters | IFD: global parameters IFD |
| IFD* | |
+------------------+-----------------------------------------+
| ProfileType* | n: type of data stored in TIFF file |
+------------------+-----------------------------------------+
| FaxProfile* | n: ITU-compatible fax mode |
+------------------+-----------------------------------------+
| CodingMethods* | n: compression algorithms used in file |
+------------------+-----------------------------------------+
| ModeNumber* | n: version of ITU fax standard |
+------------------+-----------------------------------------+
+------------------------------------------------------------+
| VersionYear* | byte sequence: year of ITU fax standard |
+------------------+-----------------------------------------+