DRAFT TIFF Technical Note #2				17-Mar-95
============================

This Technical Note describes serious problems that have been found in
TIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22
of the TIFF 6.0 spec of 3 June 1992).  A replacement TIFF/JPEG
specification is given.  Some corrections to Section 21 are also given.

To permit TIFF implementations to continue to read existing files, the 6.0
JPEG fields and tag values will remain reserved indefinitely.  However,
TIFF writers are strongly discouraged from using the 6.0 JPEG design.  It
is expected that the next full release of the TIFF specification will not
describe the old design at all, except to note that certain tag numbers
are reserved.  The existing Section 22 will be replaced by the
specification text given in the second part of this Tech Note.


Problems in TIFF 6.0 JPEG
=========================

Abandoning a published spec is not a step to be taken lightly.  This
section summarizes the reasons that have forced this decision.
TIFF 6.0's JPEG design suffers from design errors and limitations,
ambiguities, and unnecessary complexity.


Design errors and limitations
-----------------------------

The fundamental design error in the existing Section 22 is that JPEG's
various tables and parameters are broken out as separate fields which the
TIFF control logic must manage.  This is bad software engineering: that
information should be treated as private to the JPEG codec
(compressor/decompressor).  Worse, the fields themselves are specifiedR>


Class B for bilevel images
SamplesPerPixel = 1
BitsPerSample = 1
Compression = 1 (none), 2 (CCITT 1D), or 32773 (PackBits)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class G for grayscale images SamplesPerPixel = 1
BitsPerSample = 4, 8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class P for palette color images SamplesPerPixel = 1
BitsPerSample = 1-8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 3 (Palette RGB)
ColorMap Class R for RGB full color images SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 2 (RGB)
Class F for facsimile (Class B tags plus...)
Compression = 3 (CCITT Group 3), 4 (CCITT Group 4)
FillOrder = 1 (MSB), 2 (LSB)
Group3Options = 1 (2d encoding), 4 (zero fill), 5 (2d+fill)
ImageWidth = 1728, 2048, 2482
NewSubFileType = 2
ResolutionUnit = 2 (Inch), 3 (Centimeter)
PageNumber, XResolution, YResolution, Software, BadFaxLines, CleanFaxData, ConsecutiveBadFaxLines, DateTime, DocumentName, ImageDescription, Orientation Class S for separated images SamplesPerPixel = 4
PlanarConfiguration = 1, 2
Compression = 1 (none), 5 (LZW)
PhotometricInterpretation = 5 (Separated)
InkSet = 1 (CMYK)
DotRange, InkNames, DotRange, TargetPrinter Class Y for YCbCr images SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none), 5 (LZW), 7 (JPEG)
PhotometricInterpretation = 6 (YCbCr)
YCbCrCoefficients, YCbCrSubsampling, YCbCrPositioning
(colorimetry info from Appendix H; see above) Class "JPEG" for JPEG images (per TTN2) PhotometricInterpretation = 1 (grayscale), 2 (RGB), 5 (CMYK), 6 (YCbCr)
(Class Y tags if YCbCr)
(Class S tags if CMYK)
Compression = 7 (JPEG)

In addition, the library supports some optional compression algorithms that are, in some cases, of dubious value.

    Compression = 32766	NeXT 2-bit encoding
    Compression = 32809	ThunderScan 4-bit encoding
    Compression = 32909	Pixar companded 11-bit ZIP encoding
    Compression = 32946	PKZIP-style Deflate encoding (experimental)
    Compression = 34676	SGI 32-bit Log Luminance encoding (experimental)
    Compression = 34677	SGI 24-bit Log Luminance encoding (experimental)
Note that there is no support for the JPEG-related tags defined in the 6.0 specification; the JPEG support is based on the post-6.0 proposal given in TIFF Technical Note #2.

For more information on the experimental Log Luminance encoding consult the materials available at http://positron.cs.berkeley.edu/~gwlarson/pixformat/tiffluv.html .

The following table shows the tags that are recognized and how they are used by the library. If no use is indicated, then the library reads and writes the tag, but does not use it internally.

Tag Name Value R/W Library's Use (Comments)
NewSubFileType 254 R/W none (called SubFileType in <tiff.h>)
SubFileType 255 R/W none (called OSubFileType in <tiff.h>)
ImageWidth 256 R/W lots
ImageLength 257 R/W lots
BitsPerSample 258 R/W lots
Compression 259 R/W to select appropriate codec
PhotometricInterpretation 262 R/W lots
Thresholding 263 R/W  
CellWidth 264   parsed but ignored
CellLength 265   parsed but ignored
FillOrder 266 R/W control bit order
DocumentName 269 R/W  
ImageDescription 270 R/W  
Make 271 R/W  
Model 272 R/W  
StripOffsets 273 R/W data i/o
Orientation 274 R/W  
SamplesPerPixel 277 R/W lots
RowsPerStrip 278 R/W data i/o
StripByteCounts 279 R/W data i/o
MinSampleValue 280 R/W  
MaxSampleValue 281 R/W  
XResolution 282 R/W  
YResolution 283 R/W used by Group 3 2d encoder
PlanarConfiguration 284 R/W data i/o
PageName 285 R/W  
XPosition 286 R/W  
YPosition 286 R/W  
FreeOffsets 288   parsed but ignored
FreeByteCounts 289   parsed but ignored
GrayResponseUnit 290   parsed but ignored
GrayResponseCurve 291   parsed but ignored
Group3Options 292 R/W used by Group 3 codec
Group4Options 293 R/W  
ResolutionUnit 296 R/W used by Group 3 2d encoder
PageNumber 297 R/W  
ColorResponseUnit 300   parsed but ignored
TransferFunction 301 R/W  
Software 305 R/W  
DateTime 306 R/W  
Artist 315 R/W  
HostComputer 316 R/W  
Predictor 317 R/W used by LZW codec
WhitePoint 318 R/W  
PrimaryChromacities 319 R/W  
ColorMap 320 R/W  
TileWidth 322 R/W data i/o
TileLength 323 R/W data i/o
TileOffsets 324 R/W data i/o
TileByteCounts 324 R/W data i/o
BadFaxLines 326 R/W  
CleanFaxData 327 R/W  
ConsecutiveBadFaxLines 328 R/W  
SubIFD 330 R/W subimage descriptor support
InkSet 332 R/W  
InkNames 333 R/W  
DotRange 336 R/W  
TargetPrinter 337 R/W  
ExtraSamples 338 R/W lots
SampleFormat 339 R/W  
SMinSampleValue 340 R/W  
SMaxSampleValue 341 R/W  
JPEGTables 347 R/W used by JPEG codec
YCbCrCoefficients 529 R/W used by TIFFReadRGBAImage support
YCbCrSubsampling 530 R/W tile/strip size calculations
YCbCrPositioning 531 R/W  
ReferenceBlackWhite 532 R/W  
Matteing 32995 R none (obsoleted by ExtraSamples tag)
DataType 32996 R none (obsoleted by SampleFormat tag)
ImageDepth 32997 R/W tile/strip calculations
TileDepth 32998 R/W tile/strip calculations
StoNits 37439 R/W  

The Matteing and DataType tags have been obsoleted by the 6.0 ExtraSamples and SampleFormat tags. Consult the documentation on the ExtraSamples tag and Associated Alpha for elaboration. Note however that if you use Associated Alpha, you are expected to save data that is pre-multipled by Alpha. If this means nothing to you, check out Porter & Duff's paper in the '84 SIGGRAPH proceedings: "Compositing Digital Images".

The ImageDepth tag is a non-standard, but registered tag that specifies the Z-dimension of volumetric data. The combination of ImageWidth, ImageLength, and ImageDepth, defines a 3D volume of pixels that are further specified by BitsPerSample and SamplesPerPixel. The TileDepth tag (also non-standard, but registered) can be used to specified a subvolume "tiling" of a volume of data.

The Colorimetry, and CMYK tags are additions that appear in TIFF 6.0. Consult the TIFF 6.0 specification included in the doc directory and online.

The JPEG-related tag is specified in TIFF Technical Note #2 which defines a revised JPEG-in-TIFF scheme (revised over that appendix that was part of the TIFF 6.0 specification).


Last updated: $Date: 2004/07/06 20:42:00 $ ./usr/share/doc/libtiff4/html/TIFFTechNote2.html0000644000000000000000000010556210463723765021460 0ustar rootroot00000000000000
DRAFT TIFF Technical Note #2				17-Mar-95
============================

This Technical Note describes serious problems that have been found in
TIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22
of the TIFF 6.0 spec of 3 June 1992).  A replacement TIFF/JPEG
specification is given.  Some corrections to Section 21 are also given.

To permit TIFF implementations to continue to read existing files, the 6.0
JPEG fields and tag values will remain reserved indefinitely.  However,
TIFF writers are strongly discouraged from using the 6.0 JPEG design.  It
is expected that the next full release of the TIFF specification will not
describe the old design at all, except to note that certain tag numbers
are reserved.  The existing Section 22 will be replaced by the
specification text given in the second part of this Tech Note.


Problems in TIFF 6.0 JPEG
=========================

Abandoning a published spec is not a step to be taken lightly.  This
section summarizes the reasons that have forced this decision.
TIFF 6.0's JPEG design suffers from design errors and limitations,
ambiguities, and unnecessary complexity.


Design errors and limitations
-----------------------------

The fundamental design error in the existing Section 22 is that JPEG's
various tables and parameters are broken out as separate fields which the
TIFF control logic must manage.  This is bad software engineering: that
information should be treated as private to the JPEG codec
(compressor/decompressor).  Worse, the fields themselves are specifiedR>


Class B for bilevel images
SamplesPerPixel = 1
BitsPerSample = 1
Compression = 1 (none), 2 (CCITT 1D), or 32773 (PackBits)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class G for grayscale images SamplesPerPixel = 1
BitsPerSample = 4, 8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class P for palette color images SamplesPerPixel = 1
BitsPerSample = 1-8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 3 (Palette RGB)
ColorMap Class R for RGB full color images SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 2 (RGB)
Class F for facsimile (Class B tags plus...)
Compression = 3 (CCITT Group 3), 4 (CCITT Group 4)
FillOrder = 1 (MSB), 2 (LSB)
Group3Options = 1 (2d encoding), 4 (zero fill), 5 (2d+fill)
ImageWidth = 1728, 2048, 2482
NewSubFileType = 2
ResolutionUnit = 2 (Inch), 3 (Centimeter)
PageNumber, XResolution, YResolution, Software, BadFaxLines, CleanFaxData, ConsecutiveBadFaxLines, DateTime, DocumentName, ImageDescription, Orientation Class S for separated images SamplesPerPixel = 4
PlanarConfiguration = 1, 2
Compression = 1 (none), 5 (LZW)
PhotometricInterpretation = 5 (Separated)
InkSet = 1 (CMYK)
DotRange, InkNames, DotRange, TargetPrinter Class Y for YCbCr images SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none), 5 (LZW), 7 (JPEG)
PhotometricInterpretation = 6 (YCbCr)
YCbCrCoefficients, YCbCrSubsampling, YCbCrPositioning
(colorimetry info from Appendix H; see above) Class "JPEG" for JPEG images (per TTN2) PhotometricInterpretation = 1 (grayscale), 2 (RGB), 5 (CMYK), 6 (YCbCr)
(Class Y tags if YCbCr)
(Class S tags if CMYK)
Compression = 7 (JPEG)

In addition, the library supports some optional compression algorithms that are, in some cases, of dubious value.

    Compression = 32766	NeXT 2-bit encoding
    Compression = 32809	ThunderScan 4-bit encoding
    Compression = 32909	Pixar companded 11-bit ZIP encoding
    Compression = 32946	PKZIP-style Deflate encoding (experimental)
    Compression = 34676	SGI 32-bit Log Luminance encoding (experimental)
    Compression = 34677	SGI 24-bit Log Luminance encoding (experimental)
Note that there is no support for the JPEG-related tags defined in the 6.0 specification; the JPEG support is based on the post-6.0 proposal given in TIFF Technical Note #2.

For more information on the experimental Log Luminance encoding consult the materials available at http://positron.cs.berkeley.edu/~gwlarson/pixformat/tiffluv.html .

The following table shows the tags that are recognized and how they are used by the library. If no use is indicated, then the library reads and writes the tag, but does not use it internally.

Tag Name Value R/W Library's Use (Comments)
NewSubFileType 254 R/W none (called SubFileType in <tiff.h>)
SubFileType 255 R/W none (called OSubFileType in <tiff.h>)
ImageWidth 256 R/W lots
ImageLength 257 R/W lots
BitsPerSample 258 R/W lots
Compression 259 R/W to select appropriate codec
PhotometricInterpretation 262 R/W lots
Thresholding 263 R/W  
CellWidth 264   parsed but ignored
CellLength 265   parsed but ignored
FillOrder 266 R/W control bit order
DocumentName 269 R/W  
ImageDescription 270 R/W  
Make 271 R/W  
Model 272 R/W  
StripOffsets 273 R/W data i/o
Orientation 274 R/W  
SamplesPerPixel 277 R/W lots
RowsPerStrip 278 R/W data i/o
StripByteCounts 279 R/W data i/o
MinSampleValue 280 R/W  
MaxSampleValue 281 R/W  
XResolution 282 R/W  
YResolution 283 R/W used by Group 3 2d encoder
PlanarConfiguration 284 R/W data i/o
PageName 285 R/W  
XPosition 286 R/W  
YPosition 286 R/W  
FreeOffsets 288   parsed but ignored
FreeByteCounts 289   parsed but ignored
GrayResponseUnit 290   parsed but ignored
GrayResponseCurve 291   parsed but ignored
Group3Options 292 R/W used by Group 3 codec
Group4Options 293 R/W  
ResolutionUnit 296 R/W used by Group 3 2d encoder
PageNumber 297 R/W  
ColorResponseUnit 300   parsed but ignored
TransferFunction 301 R/W  
Software 305 R/W  
DateTime 306 R/W  
Artist 315 R/W  
HostComputer 316 R/W  
Predictor 317 R/W used by LZW codec
WhitePoint 318 R/W  
PrimaryChromacities 319 R/W  
ColorMap 320 R/W  
TileWidth 322 R/W data i/o
TileLength 323 R/W data i/o
TileOffsets 324 R/W data i/o
TileByteCounts 324 R/W data i/o
BadFaxLines 326 R/W  
CleanFaxData 327 R/W  
ConsecutiveBadFaxLines 328 R/W  
SubIFD 330 R/W subimage descriptor support
InkSet 332 R/W  
InkNames 333 R/W  
DotRange 336 R/W  
TargetPrinter 337 R/W  
ExtraSamples 338 R/W lots
SampleFormat 339 R/W  
SMinSampleValue 340 R/W  
SMaxSampleValue 341 R/W  
JPEGTables 347 R/W used by JPEG codec
YCbCrCoefficients 529 R/W used by TIFFReadRGBAImage support
YCbCrSubsampling 530 R/W tile/strip size calculations
YCbCrPositioning 531 R/W  
ReferenceBlackWhite 532 R/W  
Matteing 32995 R none (obsoleted by ExtraSamples tag)
DataType 32996 R none (obsoleted by SampleFormat tag)
ImageDepth 32997 R/W tile/strip calculations
TileDepth 32998 R/W tile/strip calculations
StoNits 37439 R/W  

The Matteing and DataType tags have been obsoleted by the 6.0 ExtraSamples and SampleFormat tags. Consult the documentation on the ExtraSamples tag and Associated Alpha for elaboration. Note however that if you use Associated Alpha, you are expected to save data that is pre-multipled by Alpha. If this means nothing to you, check out Porter & Duff's paper in the '84 SIGGRAPH proceedings: "Compositing Digital Images".

The ImageDepth tag is a non-standard, but registered tag that specifies the Z-dimension of volumetric data. The combination of ImageWidth, ImageLength, and ImageDepth, defines a 3D volume of pixels that are further specified by BitsPerSample and SamplesPerPixel. The TileDepth tag (also non-standard, but registered) can be used to specified a subvolume "tiling" of a volume of data.

The Colorimetry, and CMYK tags are additions that appear in TIFF 6.0. Consult the TIFF 6.0 specification included in the doc directory and online.

The JPEG-related tag is specified in TIFF Technical Note #2 which defines a revised JPEG-in-TIFF scheme (revised over that appendix that was part of the TIFF 6.0 specification).


Last updated: $Date: 2004/07/06 20:42:00 $ ./usr/share/doc/libtiff4/html/TIFFTechNote2.html0000644000000000000000000010556210463723765021460 0ustar rootroot00000000000000
DRAFT TIFF Technical Note #2				17-Mar-95
============================

This Technical Note describes serious problems that have been found in
TIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22
of the TIFF 6.0 spec of 3 June 1992).  A replacement TIFF/JPEG
specification is given.  Some corrections to Section 21 are also given.

To permit TIFF implementations to continue to read existing files, the 6.0
JPEG fields and tag values will remain reserved indefinitely.  However,
TIFF writers are strongly discouraged from using the 6.0 JPEG design.  It
is expected that the next full release of the TIFF specification will not
describe the old design at all, except to note that certain tag numbers
are reserved.  The existing Section 22 will be replaced by the
specification text given in the second part of this Tech Note.


Problems in TIFF 6.0 JPEG
=========================

Abandoning a published spec is not a step to be taken lightly.  This
section summarizes the reasons that have forced this decision.
TIFF 6.0's JPEG design suffers from design errors and limitations,
ambiguities, and unnecessary complexity.


Design errors and limitations
-----------------------------

The fundamental design error in the existing Section 22 is that JPEG's
various tables and parameters are broken out as separate fields which the
TIFF control logic must manage.  This is bad software engineering: that
information should be treated as private to the JPEG codec
(compressor/decompressor).  Worse, the fields themselves are specifiedR>


Class B for bilevel images
SamplesPerPixel = 1
BitsPerSample = 1
Compression = 1 (none), 2 (CCITT 1D), or 32773 (PackBits)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class G for grayscale images SamplesPerPixel = 1
BitsPerSample = 4, 8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black)
Class P for palette color images SamplesPerPixel = 1
BitsPerSample = 1-8
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 3 (Palette RGB)
ColorMap Class R for RGB full color images SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none) 5 (LZW)
PhotometricInterpretation = 2 (RGB)
Class F for facsimile (Class B tags plus...)
Compression = 3 (CCITT Group 3), 4 (CCITT Group 4)
FillOrder = 1 (MSB), 2 (LSB)