1 <!doctype html> 2 <html lang="en"> 3 <head> 4 <meta charset="utf-8"/> 5 <title>TIFF Metadata Format Specification and Usage Notes</title> 6 </head> 7 <!-- 8 Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. 9 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10 11 This code is free software; you can redistribute it and/or modify it 12 under the terms of the GNU General Public License version 2 only, as 13 published by the Free Software Foundation. Oracle designates this 14 particular file as subject to the "Classpath" exception as provided 15 by Oracle in the LICENSE file that accompanied this code. 16 17 This code is distributed in the hope that it will be useful, but WITHOUT 18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20 version 2 for more details (a copy is included in the LICENSE file that 21 accompanied this code). 22 23 You should have received a copy of the GNU General Public License version 24 2 along with this work; if not, write to the Free Software Foundation, 25 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26 27 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28 or visit www.oracle.com if you need additional information or have any 29 questions. 30 --> 31 32 <body> 33 <main role="main"> 34 <h1>TIFF Metadata Format Specification and Usage Notes</h1> 35 36 <a href="#Reading">Reading Images</a> 37 <ul> 38 <li><a href="#ColorConversionRead">Color Conversion</a></li> 39 <li><a href="#ColorSpacesRead">Color Spaces</a></li> 40 <li><a href="#ICCProfilesRead">ICC Profiles</a></li> 41 <li><a href="#MetadataIssuesRead">Metadata Issues</a> 42 <ul> 43 <li><a href="#MapNativeStandard">Native to Standard Metadata Mapping</a></li> 44 </ul> 45 </li> 46 <li><a href="#ExifRead">Reading Exif Images</a> 47 <ul> 48 <li><a href="#ExifReadTIFF">Reading Uncompressed Exif Images</a></li> 49 <li><a href="#ExifReadJPEG">Reading Compressed Exif Images</a></li> 50 </ul> 51 </li> 52 </ul> 53 <a href="#Writing">Writing Images</a><br/> 54 <ul> 55 <li><a href="#Compression">Compression</a></li> 56 <li><a href="#ColorConversionWrite">Color Conversion</a></li> 57 <li><a href="#ICCProfilesWrite">ICC Profiles</a></li> 58 <li><a href="#MetadataIssuesWrite">Metadata Issues</a> 59 <ul> 60 <li><a href="#MapStandardNative">Standard to Native Metadata Mapping</a></li> 61 </ul> 62 <li><a href="#ExifWrite">Writing Exif Images</a> 63 <ul> 64 <li><a href="#ExifWriteTIFF">Writing Uncompressed Exif Images</a></li> 65 <li><a href="#ExifWriteJPEG">Writing Compressed Exif Images</a></li> 66 </ul> 67 </li> 68 </ul> 69 <a href="#StreamMetadata">Native Stream Metadata Format</a><br/> 70 <a href="#ImageMetadata">Native Image Metadata Format</a> 71 72 <h2><a id="Reading">Reading Images</a></h2> 73 74 TIFF images are read by an <a href="../../ImageReader.html">ImageReader</a> 75 which may be controlled by its public interface as well as via a supplied 76 <a href="../../plugins/tiff/TIFFImageReadParam.html">TIFFImageReadParam</a>. 77 78 <!-- <h3>Supported Image Types</h3> --> 79 80 <!-- Table? --> 81 82 <h3><a id="ColorConversionRead">Color Conversion</a></h3> 83 84 <p>If the source image data 85 have photometric type CIE L*a*b* or YCbCr, and the destination color space 86 type is RGB, then the source image data will be automatically converted to 87 RGB using an internal color converter.</p> 88 89 <h3><a id="ColorSpacesRead">Color Spaces</a></h3> 90 91 The raw color space assigned by default, i.e., in the absence of a 92 user-supplied <a href="../../ImageTypeSpecifier.html">ImageTypeSpecifier</a>, 93 will be the first among the following which applies: 94 95 <ul> 96 <li>A color space created from the <a href="#ICCProfilesRead">ICC Profile</a> 97 metadata field if it is present and compatible with the image data 98 layout.</li> 99 <li><a id="nonICCProfile"></a>sRGB if the image is monochrome/bilevel 100 (a two-level color map is created internally).</li> 101 <li>sRGB if the image is palette-color.</li> 102 <li>Linear RGB if the image has three samples per pixel, has photometric type 103 CIE L*a*b*, or has photometric type YCbCr and is <i>not</i> 104 JPEG-compressed.</li> 105 <li>A <a href="#DefaultCMYK">default CMYK color space</a> if the image has 106 photometric type CMYK and four samples per pixel.</li> 107 <li>Grayscale if the image has one or two samples per pixel and uniformly 108 1, 2, 4, 8, 16, or 32 bits per sample or is floating point.</li> 109 <li>sRGB if the image has three or four samples per pixel and uniformly 110 1, 2, 4, 8, 16, or 32 bits per sample or is floating point.</li> 111 <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image 112 has more than four samples per pixel and the number of bits per sample for 113 all bands is the same and is a multiple of 8.</li> 114 <li>Grayscale if the image has one or two samples per pixel regardless of 115 the number of bits per sample.</li> 116 <li>sRGB if the image has three or four samples per pixel regardless of 117 the number of bits per sample.</li> 118 <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image 119 has more than four samples per pixel regardless of the number of bits per 120 sample.</li> 121 </ul> 122 123 <p><a id="DefaultCMYK"></a>The normalized color coordinate transformations 124 used for the default CMYK color space are defined as follows: 125 126 <ul> 127 <li>CMYK to linear RGB 128 <pre> 129 R = (1 - K)*(1 - C) 130 G = (1 - K)*(1 - M) 131 B = (1 - K)*(1 - Y) 132 </pre> 133 </li> 134 <li>Linear RGB to CMYK 135 <pre> 136 K = min{1 - R, 1 - G, 1 - B} 137 if(K != 1) { 138 C = (1 - R - K)/(1 - K) 139 M = (1 - G - K)/(1 - K) 140 Y = (1 - B - K)/(1 - K) 141 } else { 142 C = M = Y = 0 143 } 144 </pre> 145 </li> 146 </ul> 147 148 <p><a id="GenericCS"></a>The generic color space used when no other color space 149 can be inferred is provided merely to enable the data to be loaded. It is not 150 intended to provide accurate conversions of any kind.</p> 151 152 <p>If the data are known to be in a color space not correctly handled by the 153 foregoing, then an <code>ImageTypeSpecifier</code> should be 154 supplied to the reader and should be derived from a color space which is correct 155 for the data in question.</p> 156 157 <h3><a id="ICCProfilesRead">ICC Profiles</a></h3> 158 159 If an ICC profile is contained in the image metadata 160 (<a href="../../plugins/tiff/BaselineTIFFTagSet.html"> 161 BaselineTIFFTagSet</a>.TAG_ICC_PROFILE, tag number 34675), 162 an attempt will be made to use it to create the color space 163 of the loaded image. It will be used if the data layout is of component type 164 and the number of samples per pixel equals or is one greater than the number 165 of components described by the ICC profile. If the ICC profile is not used 166 then the color space will be inferred in one of the subsequent steps described 167 <a href="#nonICCProfile">above</a>. 168 169 <p>If for some reason the embedded ICC profile is not used automatically, then 170 it may be used manually by following this procedure: 171 172 <ol> 173 <li>Obtain the image metadata from 174 <code>ImageReader.getImageMetadata</code></li> 175 <li>Extract the ICC profile field and its value.</li> 176 <li>Create an <a href="../../../../java/awt/color/ICC_ColorSpace.html"> 177 ICC_ColorSpace</a> from an 178 <a href="../../../../java/awt/color/ICC_Profile.html"> 179 ICC_Profile</a> created from the ICC profile field data 180 using <code>ICC_Profile.getInstance(byte[])</code>.</li> 181 <li>Create an <code>ImageTypeSpecifier</code> from the new color 182 space using one of its factory methods which accepts an 183 <code>ICC_ColorSpace</code>. 184 <li>Create a compatible <a href="../../ImageReadParam.html">ImageReadParam</a> 185 and set the <code>ImageTypeSpecifier</code> using 186 <code>ImageReadParam.setDestinationType</code>.</li> 187 <li>Pass the parameter object to the appropriate <code>read</code> method.</li> 188 </ol> 189 190 <p>If the inferred color space not based on the ICC Profile field is compatible 191 with the ICC profile-based color space, then a second 192 <code>ImageTypeSpecifier</code> derived from this inferred color 193 space will be included in the 194 {@link java.util.Iterator Iterator} returned by 195 <code>ImageReader.getImageTypes</code>. If the iterator contains 196 more than one type, the first one will be based on the ICC profile and the 197 second on the inferred color space.</p> 198 199 <h3><a id="MetadataIssuesRead">Metadata Issues</a></h3> 200 201 By default all recognized fields in the TIFF image file directory (IFD) are 202 loaded into the native image metadata object. Which fields are loaded may be 203 controlled by setting which TIFF tags the reader is allowed to recognize, 204 whether to read fields with unrecognized tags, and whether to ignore all 205 metadata. The reader is informed to disregard all metadata as usual via the 206 <code>ignoreMetadata</code> parameter of 207 <code>ImageReader.setInput(Object,boolean,boolean)</code>. It is 208 informed of which <a href="../../plugins/tiff/TIFFTag.html">TIFFTag</a>s to 209 recognize or not to recognize via 210 <code>TIFFImageReadParam.addAllowedTagSet(TIFFTagSet)</code> and 211 <code>TIFFImageReadParam.removeAllowedTagSet(TIFFTagSet)</code>. 212 If <code>ignoreMetadata</code> is <code>true</code>, then only metadata 213 essential to reading the image will be loaded into the native image metadata 214 object. If <code>ignoreMetadata</code> is <code>false</code>, then the reader 215 will by default load into the native image metadata object only those fields 216 which are either essential to reading the image or have a <code>TIFFTag</code> 217 contained in the one of the allowed <code>TIFFTagSet</code>s. Reading of 218 fields with tags not in the allowed <code>TIFFTagSet</code>s may be forced 219 by passing in a <code>TIFFImageReadParam</code> on which 220 <code>TIFFImageReadParam.setReadUnknownTags(boolean)</code> has been 221 invoked with parameter <code>true</code>. 222 223 <p>Use of a <a href="../../plugins/tiff/TIFFDirectory.html">TIFFDirectory</a> 224 object may simplify gaining access to metadata values. An instance of 225 <code>TIFFDirectory</code> may be created from the <code>IIOMetadata</code> 226 object returned by the TIFF reader using the 227 <code>TIFFDirectory.createFromMetadata</code> method.</p> 228 229 <h4><a id="MapNativeStandard"></a> 230 Mapping of TIFF Native Image Metadata to the Standard Metadata Format</h4> 231 232 The derivation of standard metadata format 233 <a href="standard_metadata.html">javax_imageio_1.0</a> 234 elements from <a href="#ImageMetadata">TIFF native image metadata</a> is given 235 in the following table. 236 237 <table border="1"> 238 <thead> 239 <tr> 240 <th scope="col">Index</th> 241 <th scope="col">Standard Metadata Element</th> 242 <th scope="col">Derivation from TIFF Fields</th> 243 </tr> 244 </thead> 245 <tbody> 246 <tr> 247 <th scope="row">1</th> 248 <td>/Chroma/ColorSpaceType@name</td> 249 <td>PhotometricInterpretation: WhiteIsZero, BlackIsZero, TransparencyMask = 250 "GRAY"; RGB, PaletteColor => "RGB"; CMYK => "CMYK"; 251 YCbCr => "YCbCr"; 252 CIELab, ICCLab => "Lab".</td> 253 </tr> 254 <tr> 255 <th scope="row">2</th> 256 <td>/Chroma/NumChannels@value</td> 257 <td>SamplesPerPixel</td> 258 </tr> 259 <tr> 260 <th scope="row">3</th> 261 <td>/Chroma/BlackIsZero@value</td> 262 <td>"TRUE" <=> PhotometricInterpretation => WhiteIsZero</td> 263 </tr> 264 <tr> 265 <th scope="row">4</th> 266 <td>/Chroma/Palette</td> 267 <td>ColorMap</td> 268 </tr> 269 <tr> 270 <th scope="row">5</th> 271 <td>/Compression/CompressionTypeName@value</td> 272 <td>Compression: Uncompressed => "none"; CCITT 1D => "CCITT 273 RLE"; 274 Group 3 Fax => "CCITT T.4"; Group 4 Fax => "CCITT T.6"; 275 LZW => "LZW"; 276 JPEG => "Old JPEG"; New JPEG => "JPEG"; Zlib =>> "ZLib"; PackBits => 277 "PackBits"; 278 Deflate => "Deflate"; Exif JPEG => "JPEG".</td> 279 </tr> 280 <tr> 281 <th scope="row">6</th> 282 <td>/Compression/Lossless@value</td> 283 <td>Compression: JPEG or New JPEG => "FALSE"; otherwise "TRUE".</td> 284 </tr> 285 <tr> 286 <th scope="row">7</th> 287 <td>/Data/PlanarConfiguration@value</td> 288 <td>Chunky => "PixelInterleaved"; Planar => "PlaneInterleaved".</td> 289 </tr> 290 <tr> 291 <th scope="row">8</th> 292 <td>/Data/SampleFormat@value</td> 293 <td>PhotometricInterpretation PaletteColor => "Index"; 294 SampleFormat unsigned integer data => "UnsignedIntegral"; 295 SampleFormat two's complement signed integer data => "SignedIntegral"; 296 SampleFormat IEEE floating point data => "Real"; 297 otherwise element not emitted. 298 </td> 299 </tr> 300 <tr> 301 <th scope="row">9</th> 302 <td>/Data/BitsPerSample@value</td> 303 <td>BitsPerSample as a space-separated list.</td> 304 </tr> 305 <tr> 306 <th scope="row">10</th> 307 <td>/Data/SampleMSB@value</td> 308 <td>FillOrder: left-to-right => space-separated list of BitsPerSample-1; 309 right-to-left => space-separated list of 0s.</td> 310 </tr> 311 <tr> 312 <th scope="row">11</th> 313 <td>/Dimension/PixelAspectRatio@value</td> 314 <td>(1/XResolution)/(1/YResolution)</td> 315 </tr> 316 <tr> 317 <th scope="row">12</th> 318 <td>/Dimension/ImageOrientation@value</td> 319 <td>Orientation</td> 320 </tr> 321 <tr> 322 <th scope="row">13</th> 323 <td>/Dimension/HorizontalPixelSize@value</td> 324 <td>1/XResolution in millimeters if ResolutionUnit is not None.</td> 325 </tr> 326 <tr> 327 <th scope="row">14</th> 328 <td>/Dimension/VerticalPixelSize@value</td> 329 <td>1/YResolution in millimeters if ResolutionUnit is not None.</td> 330 </tr> 331 <tr> 332 <th scope="row">15</th> 333 <td>/Dimension/HorizontalPosition@value</td> 334 <td>XPosition in millimeters if ResolutionUnit is not None.</td> 335 </tr> 336 <tr> 337 <th scope="row">16</th> 338 <td>/Dimension/VerticalPosition@value</td> 339 <td>YPosition in millimeters if ResolutionUnit is not None.</td> 340 </tr> 341 <tr> 342 <th scope="row">17</th> 343 <td>/Document/FormatVersion@value</td> 344 <td>6.0</td> 345 </tr> 346 <tr> 347 <th scope="row">18</th> 348 <td>/Document/SubimageInterpretation@value</td> 349 <td>NewSubFileType: transparency => "TransparencyMask"; 350 reduced-resolution => "ReducedResolution"; 351 single page => "SinglePage".</td> 352 </tr> 353 <tr> 354 <th scope="row">19</th> 355 <td>/Document/ImageCreationTime@value</td> 356 <td>DateTime</td> 357 </tr> 358 <tr> 359 <th scope="row">20</th> 360 <td>/Text/TextEntry</td> 361 <td>DocumentName, ImageDescription, Make, Model, PageName, Software, 362 Artist, HostComputer, InkNames, Copyright: 363 /Text/TextEntry@keyword = field name, 364 /Text/TextEntry@value = field value.<br> 365 Example: TIFF Software field => /Text/TextEntry@keyword = "Software", 366 /Text/TextEntry@value = Name and version number of the software package(s) 367 used to create the image.</td> 368 </tr> 369 <tr> 370 <th scope="row">21</th> 371 <td>/Transparency/Alpha@value</td> 372 <td>ExtraSamples: associated alpha => "premultiplied"; 373 unassociated alpha => "nonpremultiplied".</td> 374 </tr> 375 </tbody> 376 </table> 377 378 <h3><a id="ExifRead">Reading Exif Images</a></h3> 379 380 The TIFF reader may be used to read an uncompressed Exif image or the 381 contents of the <code>APP1</code> marker segment of a compressed Exif image. 382 383 <h4><a id="ExifReadTIFF">Reading Uncompressed Exif Images</a></h4> 384 385 An uncompressed Exif image is a one- or two-page uncompressed TIFF image 386 with a specific ordering of its IFD and image data content. Each pixel 387 has three 8-bit samples with photometric interpretation RGB or YCbCr. 388 The image stream must contain a single primary image and may contain a 389 single thumbnail which if present must also be uncompressed. The usual 390 <code>ImageReader</code> methods may be used to read the image 391 data and metadata: 392 393 <pre><code> 394 ImageInputStream input; 395 ImageReader tiffReader; 396 ImageReadParam tiffReadParam; 397 398 tiffReader.setInput(input); 399 400 // Read primary image and IFD. 401 BufferedImage image = tiffReader.read(0, tiffReadParam); 402 IIOMetadata primaryIFD = tiffReader.getImageMetadata(0); 403 404 // Read thumbnail if present. 405 BufferedImage thumbnail = null; 406 if (tiffReader.getNumImages(true) > 1) { 407 thumbnail = tiffReader.read(1, tiffReadParam); 408 } 409 </code></pre> 410 411 Note that the Exif thumbnail is treated as a separate page in the TIFF 412 stream and not as a thumbnail, i.e., 413 <code>tiffReader.hasThumbnails(0)</code> will return <code>false</code>. 414 415 <h4><a id="ExifReadJPEG">Reading Compressed Exif Images</a></h4> 416 417 A compressed Exif image is a 3-band ISO/IEC 10918-1 baseline DCT JPEG stream 418 with an inserted <code>APP1</code> marker segment. The parameters of the marker 419 segment after the length are the 6-byte sequence 420 <code>{'E', 'x', 'i', 'f', 0x00, 0x00}</code> 421 followed by a complete TIFF stream. The embedded TIFF stream contains a primary 422 IFD describing the JPEG image optionally followed by a thumbnail IFD and 423 compressed or uncompressed thumbnail image data. Note that the embedded TIFF 424 stream does not contain any image data associated with the primary IFD 425 nor any descriptive fields which duplicate information found in the JPEG 426 stream itself. 427 428 <p>The parameter content of the <code>APP1</code> marker segment may be obtained 429 from the user object of the associated <code>Node</code> in a 430 <code>javax_imageio_jpeg_image_1.0</code> native image metadata tree extracted 431 from the image metadata object returned by the JPEG reader. This APP1 Exif 432 node will be a child of the node named "markerSequence" and will 433 have name <code>unknown</code> and an attribute named <code>MarkerTag</code> with 434 integral value <code>0xE1</code> (<code>String</code> value 435 <code>"225"</code>). The user object of this node will be a byte array 436 which starts with the six bytes <code>{'E', 'x', 'i', 'f', '0', '0'}</code>. 437 The primary IFD and the thumbnail IFD and image may be 438 read from the user object by the usual <code>ImageReader</code> 439 methods: 440 441 <pre><code> 442 ImageReader jpegReader; 443 ImageReader tiffReader; 444 445 // Obtain the APP1 Exif marker data from the JPEG image metadata. 446 IIOMetadata jpegImageMetadata = jpegReader.getImageMetadata(0); 447 String nativeFormat = jpegImageMetadata.getNativeMetadataFormatName(); 448 Node jpegImageMetadataTree = jpegImageMetadata.getAsTree(nativeFormat); 449 450 // getExifMarkerData() returns the byte array which is the user object 451 // of the APP1 Exif marker node. 452 byte[] app1Params = getExifMarkerData(jpegImageMetadataTree); 453 if (app1Params == null) { 454 throw new IIOException("APP1 Exif marker not found."); 455 } 456 457 // Set up input, skipping Exif ID 6-byte sequence. 458 MemoryCacheImageInputStream app1ExifInput 459 = new MemoryCacheImageInputStream 460 (new ByteArrayInputStream(app1Params, 6, app1Params.length - 6)); 461 tiffReader.setInput(app1ExifInput); 462 463 // Read primary IFD. 464 IIOMetadata primaryIFD = tiffReader.getImageMetadata(0); 465 466 // Read thumbnail if present. 467 BufferedImage thumbnail = null; 468 if (tiffReader.getNumImages(true) > 1) { 469 thumbnail = tiffReader.read(1, tiffReadParam); 470 } 471 472 // Read the primary image. 473 BufferedImage image = jpegReader.read(0); 474 </code></pre> 475 476 Note that <code>tiffReader.getNumImages(true)</code> returns the number of 477 IFDs in the embedded TIFF stream including those corresponding to empty 478 images. Calling <code>tiffReader.read(0, readParam)</code> will throw 479 an exception as the primary image in the embedded TIFF stream is always 480 empty; the primary image should be obtained using the JPEG reader itself. 481 482 <h2><a id="Writing">Writing Images</a></h2> 483 484 TIFF images are written by a <a href="../../ImageWriter.html">ImageWriter</a> which may be 485 controlled by its public interface as well as via a supplied 486 <a href="../../ImageWriteParam.html">ImageWriteParam</a>. For an <code>ImageWriteParam</code> returned 487 by the <code>getDefaultWriteParam()</code> method of the TIFF <code>ImageWriter</code>, 488 the <code>canWriteTiles()</code> and <code>canWriteCompressed()</code> methods 489 will return <code>true</code>; the <code>canOffsetTiles()</code> and 490 <code>canWriteProgressive()</code> methods will return <code>false</code>. 491 492 The TIFF writer supports many optional capabilities including writing tiled 493 images, inserting images, writing or inserting empty images, and replacing image 494 data. Pixels may be replaced in either empty or non-empty images but if and 495 only if the data are not compressed. 496 497 <p> If tiles are being written, then each of their dimensions will be 498 rounded to the nearest multiple of 16 per the TIFF specification. If 499 JPEG-in-TIFF compression is being used, and tiles are being written 500 each tile dimension will be rounded to the nearest multiple of 8 times 501 the JPEG minimum coded unit (MCU) in that dimension. If JPEG-in-TIFF 502 compression is being used and strips are being written, the number of 503 rows per strip is rounded to a multiple of 8 times the maximum MCU over 504 both dimensions.</p> 505 506 <!-- <h3>Supported Image Types</h3> --> 507 508 <!-- Table? --> 509 510 <h3><a id="Compression">Compression</a></h3> 511 512 The compression type may be set via the <code>setCompressionType()</code> method of 513 the <code>ImageWriteParam</code> after setting the compression mode to 514 <code>MODE_EXPLICIT</code>. The set of innately 515 supported compression types is listed in the following table: 516 517 <table border=1> 518 <caption><b>Supported Compression Types</b></caption> 519 <thead> 520 <tr> 521 <th scope="col">Index</th> 522 <th scope="col">Compression Type</th> 523 <th scope="col">Description</th> 524 <th scope="col">Reference</th></tr> 525 <tr> 526 </thead> 527 <tbody> 528 <th scope="row">1</th> 529 <td>CCITT RLE</td> 530 <td>Modified Huffman compression</td> 531 <td>TIFF 6.0 Specification, Section 10</td> 532 </tr> 533 <tr> 534 <th scope="row">2</th> 535 <td>CCITT T.4</td> 536 <td>CCITT T.4 bilevel encoding/Group 3 facsimile compression</td> 537 <td>TIFF 6.0 Specification, Section 11</td> 538 </tr> 539 <tr> 540 <th scope="row">3</th> 541 <td>CCITT T.6</td> 542 <td>CCITT T.6 bilevel encoding/Group 4 facsimile compression</td> 543 <td>TIFF 6.0 Specification, Section 11</td></tr> 544 <tr> 545 <th scope="row">4</th> 546 <td>LZW</td> 547 <td>LZW compression</td> 548 <td>TIFF 6.0 Specification, Section 13</td></tr> 549 <tr> 550 <th scope="row">5</th> 551 <td>JPEG</td> 552 <td>"New" JPEG-in-TIFF compression</td> 553 <td>TIFF Technical Note #2</td></tr> 554 <tr> 555 <th scope="row">6</th> 556 <td>ZLib</td> 557 <td>"Deflate/Inflate" compression (see note following this table)</td> 558 <td>Adobe Photoshop® TIFF Technical Notes</td> 559 </tr> 560 <tr> 561 <th scope="row">7</th> 562 <td>PackBits</td> 563 <td>Byte-oriented, run length compression</td> 564 <td>TIFF 6.0 Specification, Section 9</td> 565 </tr> 566 <tr> 567 <th scope="row">8</th> 568 <td>Deflate</td> 569 <td>"Zip-in-TIFF" compression (see note following this table)</td> 570 <td><a href="https://tools.ietf.org/html/rfc1950"> 571 ZLIB Compressed Data Format Specification</a>, 572 <a href="https://tools.ietf.org/html/rfc1951"> 573 DEFLATE Compressed Data Format Specification</a></td> 574 </tr> 575 <tr> 576 <th scope="row">9</th> 577 <td>Exif JPEG</td> 578 <td>Exif-specific JPEG compression (see note following this table)</td> 579 <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a> 580 (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td> 581 </tbody> 582 </table> 583 584 <p> 585 Old-style JPEG compression as described in section 22 of the TIFF 6.0 586 Specification is <i>not</i> supported. 587 </p> 588 589 <p> The CCITT compression types are applicable to bilevel (1-bit) 590 images only. The JPEG compression type is applicable to byte 591 grayscale (1-band) and RGB (3-band) images only.</p> 592 593 <p> 594 ZLib and Deflate compression are identical except for the value of the 595 TIFF Compression field: for ZLib the Compression field has value 8 596 whereas for Deflate it has value 32946 (0x80b2). In both cases each 597 image segment (strip or tile) is written as a single complete zlib data 598 stream. 599 </p> 600 601 <p> 602 "Exif JPEG" is a compression type used when writing the contents of an 603 APP1 Exif marker segment for inclusion in a JPEG native image metadata 604 tree. The contents appended to the output when this compression type is 605 used are a function of whether an empty or non-empty image is written. 606 If the image is empty, then a TIFF IFD adhering to the specification of 607 a compressed Exif primary IFD is appended. If the image is non-empty, 608 then a complete IFD and image adhering to the specification of a 609 compressed Exif thumbnail IFD and image are appended. Note that the 610 data of the empty image may <i>not</i> later be appended using the pixel 611 replacement capability of the TIFF writer. 612 </p> 613 614 <p> If ZLib/Deflate or JPEG compression is used, the compression quality 615 may be set. For ZLib/Deflate the supplied floating point quality value is 616 rescaled to the range <code>[1, 9]</code> and truncated to an integer 617 to derive the Deflate compression level. For JPEG the floating point 618 quality value is passed directly to the JPEG writer plug-in which 619 interprets it in the usual way.</p> 620 621 <h3><a id="ColorConversionWrite">Color Conversion</a></h3> 622 623 <p>If the source image data 624 color space type is RGB, and the destination photometric type is CIE L*a*b* or 625 YCbCr, then the source image data will be automatically converted from 626 RGB using an internal color converter.</p> 627 628 <h3><a id="ICCProfilesWrite">ICC Profiles</a></h3> 629 630 An <code>ICC Profile</code> field will be written if either: 631 <ul> 632 <li>one is present in the native image metadata 633 <a href="../IIOMetadata.html">IIOMetadata</a> instance supplied to the writer, 634 or</li> 635 <li>the <a href="../../../../java/awt/color/ColorSpace.html">ColorSpace</a> 636 of the destination <code>ImageTypeSpecifier</code> is an instance of 637 <code>ICC_ColorSpace</code> which is not one of the standard 638 color spaces defined by the <code>CS_*</code> constants in the 639 <code>ColorSpace</code> class. The destination type is set via 640 <code>ImageWriteParam.setDestinationType(ImageTypeSpecifier)</code> and defaults 641 to the <code>ImageTypeSpecifier</code> of the image being written. 642 </li> 643 </ul> 644 645 <h3><a id="MetadataIssuesWrite">Metadata Issues</a></h3> 646 647 Some behavior of the writer is affected by or may affect the contents of 648 the image metadata which may be supplied by the user. 649 650 <p>For bilevel images, the <code>FillOrder</code>, and <code>T4Options</code> 651 fields affect the output data. The data will be filled right-to-left if 652 <code>FillOrder</code> is present with a value of 2 653 (<code>BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT</code>) 654 and will be filled left-to-right otherwise. The value of <code>T4Options</code> 655 specifies whether the data should be 1D- or 2D-encoded and whether EOL 656 padding should be used.</p> 657 658 <p>For all images the value of the <code>RowsPerStrip</code> field is used 659 to the set the number of rows per strip if the image is not tiled. The 660 default number of rows per strip is either 8 or the number of rows which 661 would fill no more than 8 kilobytes, whichever is larger.</p> 662 663 <p>For all images the tile dimensions may be set using the <code>TileWidth</code> 664 and <code>TileLength</code> field values if the tiling mode is 665 <code>ImageWriteParam.MODE_COPY_FROM_METADATA</code>. If this mode 666 is set but the fields are not, their respective default values are the image 667 width and height.</p> 668 669 <p>When using JPEG-in-TIFF compression, a <code>JPEGTables</code> field will be 670 written to the IFD and abbreviated JPEG streams to each strip or tile if and 671 only if a <code>JPEGTables</code> field is contained in the metadata object 672 provided to the writer. If the contents of the <code>JPEGTables</code> field is 673 a valid tables-only JPEG stream, then it will be used; otherwise the contents 674 of the field will be replaced with default visually lossless tables. If no 675 such <code>JPEGTables</code> field is present in the metadata, then no 676 <code>JPEGTables</code> field will be written to the output and each strip or 677 tile will be written as a separate, self-contained JPEG stream.</p> 678 679 <p>When using Deflate/ZLib or LZW compression, if the image has 8 bits per 680 sample, a horizontal differencing predictor will be used if the 681 <code>Predictor</code> field is present with a value of 2 682 (<code>BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING</code>). 683 If prediction is so requested but the image does not have 684 8 bits per sample the field will be reset to have the value 1 685 (<code>BaselineTIFFTagSet.PREDICTOR_NONE</code>). 686 </p> 687 688 <p>Some fields may be added or modified: 689 690 <ul> 691 <li><code>PhotometricInterpretation</code> if not present.</li> 692 <li><code>PlanarConfiguration</code> if this field is present with value 693 <code>Planar</code> is is reset to <code>Chunky</code>.</li> 694 <li><code>Compression</code> always.</li> 695 <li><code>BitsPerSample</code> if the image is not bilevel.</li> 696 <li><code>SamplesPerPixel</code> always.</li> 697 <li><code>ExtraSamples</code> if an alpha channel is present.</li> 698 <li><code>SampleFormat</code> if not present and the data are 16- or 32-bit 699 integers or floating point.</li> 700 <li><code>ColorMap</code> if the <code>PhotometricInterpretation</code> is 701 <code>RGBPalette</code>.</li> 702 <li><code>ImageWidth</code> and <code>ImageLength</code> always.</li> 703 <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and 704 <code>TileByteCounts</code> if a tiled image is being written.</li> 705 <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> 706 if a tiled image is <i>not</i> being written.</li> 707 <li><code>XResolution</code>, <code>YResolution</code>, and <code>ResolutionUnit</code> 708 if none of these is present.</li> 709 <li><code>YCbCrSubsampling</code> and <code>YCbCrPositioning</code> if the 710 photometric interpretation is YCbCr and the compression type is not JPEG 711 (only [1, 1] subsampling and cosited positioning are supported for 712 non-JPEG YCbCr output).</li> 713 <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and 714 <code>ReferenceBlackWhite</code>: if the compression type is JPEG and the color 715 space is RGB these will be reset to [2, 2] centered subsampling with no 716 headroom/footroom (0:255,128:255,128:255).</li> 717 </ul> 718 719 <p>Some fields may be removed: 720 721 <ul> 722 <li><code>BitsPerSample</code> if the image is bilevel.</li> 723 <li><code>ExtraSamples</code> if the image does not have an alpha channel.</li> 724 <li><code>ColorMap</code> if the photometric interpretation is not 725 <code>RGBPalette</code>.</li> 726 <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and 727 <code>TileByteCounts</code> if tiling <i>is not</i> being used.</li> 728 <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> 729 if tiling <i>is</i> being used.</li> 730 <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and 731 <code>ReferenceBlackWhite</code> if the compression type is JPEG and the 732 color space is grayscale.</li> 733 <li><code>JPEGProc</code>, <code>JPEGInterchangeFormat</code>, 734 <code>JPEGInterchangeFormatLength</code>, <code>JPEGRestartInterval</code>, 735 <code>JPEGLosslessPredictors</code>, <code>JPEGPointTransforms</code>, 736 <code>JPEGQTables</code>, <code>JPEGDCTables</code>, and 737 <code>JPEGACTables</code> if the compression type is JPEG.</li> 738 </ul> 739 740 <p>Other fields present in the supplied metadata are uninterpreted and will 741 be written as supplied.</p> 742 743 <p>If an Exif image is being written, the set of fields present and their 744 values will be modified such that the result is in accord with the Exif 2.2 745 specification.</p> 746 747 <p>Setting up the image metadata to write to a TIFF stream may be simplified 748 by using the <code>TIFFDirectory</code> class 749 which represents a TIFF IFD. A field in a TIFF IFD is represented by an 750 instance of <a href="../../plugins/tiff/TIFFField.html">TIFFField</a>. For each 751 field to be written a <code>TIFFField</code> may be added to the 752 <code>TIFFDirectory</code> and the latter converted to an 753 <code>IIOMetadata</code> object by invoking 754 <code>TIFFDirectory.getAsMetadata</code>. The 755 <code>IIOMetadata</code> object so obtained may then be passed to the TIFF 756 writer.</p> 757 758 <h4><a id="MapStandardNative"></a> 759 Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h4> 760 761 The derivation of <a href="#ImageMetadata">TIFF native image metadata</a> 762 elements from the standard metadata format 763 <a href="standard_metadata.html">javax_imageio_1.0</a> is 764 given in the following table. 765 766 <table border="1"> 767 <thead> 768 <tr> 769 <th scope="col">Index</th> 770 <th scope="col">TIFF Field</th> 771 <th scope="col">Derivation from Standard Metadata Elements</th> 772 </tr> 773 </thead> 774 <tbody> 775 <tr> 776 <th scope="row">1</th> 777 <td> 778 PhotometricInterpretation 779 </td> 780 <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE" 781 => WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value = 782 "TransparencyMask" => TransparencyMask; "RGB" and /Chroma/Palette present => 783 PaletteColor; "GRAY" => BlackIsZero; "RGB" => RGB; "YCbCr" => YCbCr; 784 "CMYK" => CMYK; "Lab" => CIELab.</td> 785 </tr> 786 <tr> 787 <th scope="row">2</th> 788 <td>SamplesPerPixel</td> 789 <td>/Chroma/NumChannels@value</td> 790 </tr> 791 <tr> 792 <th scope="row">3</th> 793 <td>ColorMap</td> 794 <td>/Chroma/Palette</td> 795 </tr> 796 <tr> 797 <th scope="row">4</th> 798 <td>Compression</td> 799 <td>/Compression/CompressionTypeName@value: "none" => Uncompressed; 800 "CCITT RLE" => CCITT 1D; "CCITT T.4" => Group 3 Fax; "CCITT T.6" => Group 4 801 Fax; "LZW" => LZW; "Old JPEG" => JPEG; "JPEG" => New JPEG; "ZLib" => ZLib; 802 "PackBits" => PackBits; "Deflate" => Deflate.</td> 803 </tr> 804 <tr> 805 <th scope="row">5</th> 806 <td>PlanarConfiguration</td> 807 <td>/Data/PlanarConfiguration@value: "PixelInterleaved" => Chunky; 808 "PlaneInterleaved" => Planar.</td> 809 </tr> 810 <tr> 811 <th scope="row">6</th> 812 <td>SampleFormat</td> 813 <td>/Data/SampleFormat@value: "SignedIntegral" => two's complement signed 814 integer data; "UnsignedIntegral" => unsigned integer data; "Real" => 815 IEEE floating point data; "Index" => unsigned integer data. 816 </td> 817 </tr> 818 <tr> 819 <th scope="row">7</th> 820 <td>BitsPerSample</td> 821 <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td> 822 </tr> 823 <tr> 824 <th scope="row">8</th> 825 <td>FillOrder</td> 826 <td>/Data/SampleMSB@value: if all values in space-separated list are 0s => 827 right-to-left; otherwise => left-to-right. 828 </td> 829 </tr> 830 <tr> 831 <th scope="row">9</th> 832 <td>XResolution</td> 833 <td>(10 / /Dimension/HorizontalPixelSize@value) or 834 (10 / (/Dimension/VerticalPixelSize@value * 835 /Dimension/PixelAspectRatio@value))</td> 836 </tr> 837 <tr> 838 <th scope="row">10</th> 839 <td>YResolution</td> 840 <td>(10 / /Dimension/VerticalPixelSize@value) or 841 (10 / (/Dimension/HorizontalPixelSize@value / 842 /Dimension/PixelAspectRatio@value))</td> 843 </tr> 844 <tr> 845 <th scope="row">11</th> 846 <td>ResolutionUnit</td> 847 <td>Centimeter if XResolution or YResolution set; otherwise None.</td> 848 </tr> 849 <tr> 850 <th scope="row">12</th> 851 <td>Orientation</td> 852 <td>/Dimension/ImageOrientation@value</td> 853 </tr> 854 <tr> 855 <th scope="row">13</th> 856 <td>XPosition</td> 857 <td>/Dimension/HorizontalPosition@value / 10</td> 858 </tr> 859 <tr> 860 <th scope="row">14</th> 861 <td>YPosition</td> 862 <td>/Dimension/VerticalPosition@value / 10</td> 863 </tr> 864 <tr> 865 <th scope="row">15</th> 866 <td>NewSubFileType</td> 867 <td>/Document/SubimageInterpretation@value: "TransparencyMask" => 868 transparency mask; "ReducedResolution" => reduced-resolution; 869 "SinglePage" => single page.</td> 870 </tr> 871 <tr> 872 <th scope="row">16</th> 873 <td>DateTime</td> 874 <td>/Document/ImageCreationTime@value</td> 875 </tr> 876 <tr> 877 <th scope="row">17</th> 878 <td>DocumentName, ImageDescription, Make, Model, PageName, Software, 879 Artist, HostComputer, InkNames, Copyright</td> 880 <td>/Text/TextEntry: if /Text/TextEntry@keyword is the name of any of the 881 TIFF Fields, e.g., "Software", then the field is added with content 882 /Text/TextEntry@value and count 1.</td> 883 </tr> 884 <tr> 885 <th scope="row">18</th> 886 <td>ExtraSamples</td> 887 <td>/Transparency/Alpha@value: "premultiplied" => associated alpha, count 1; 888 "nonpremultiplied" => unassociated alpha, count 1.</td> 889 </tr> 890 </tbody> 891 </table> 892 893 <h3><a id="ExifWrite">Writing Exif Images</a></h3> 894 895 The TIFF writer may be used to write an uncompressed Exif image or the 896 contents of the <code>APP1</code> marker segment of a compressed Exif image. 897 898 <h4><a id="ExifWriteTIFF">Writing Uncompressed Exif Images</a></h4> 899 900 When writing a sequence of images each image is normally recorded as 901 {IFD, IFD Value, Image Data}. The Exif specification requires 902 that an uncompressed Exif image be structured as follows: 903 904 <a id="ExifStructure"></a> 905 <ol> 906 <li>Image File Header</li> 907 <li>Primary IFD</li> 908 <li>Primary IFD Value</li> 909 <li>Thumbnail IFD</li> 910 <li>Thumbnail IFD Value</li> 911 <li>Thumbnail Image Data</li> 912 <li>Primary Image Data</li> 913 </ol> 914 915 To meet the requirement of the primary image data being recorded last, the 916 primary image must be written initially as an empty image and have its data 917 added via pixel replacement after the thumbnail IFD and image data have been 918 written: 919 920 <pre><code> 921 ImageWriter tiffWriter; 922 ImageWriteParam tiffWriteParam; 923 IIOMetadata tiffStreamMetadata; 924 IIOMetadata primaryIFD; 925 BufferedImage image; 926 BufferedImage thumbnail; 927 928 // Specify uncompressed output. 929 tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED); 930 931 if (thumbnail != null) { 932 // Write the TIFF header. 933 tiffWriter.prepareWriteSequence(tiffStreamMetadata); 934 935 // Append the primary IFD. 936 tiffWriter.prepareInsertEmpty(-1, // append 937 new ImageTypeSpecifier(image), 938 image.getWidth(), 939 image.getHeight(), 940 primaryIFD, 941 null, // thumbnails 942 tiffWriteParam); 943 tiffWriter.endInsertEmpty(); 944 945 // Append the thumbnail image data. 946 tiffWriter.writeToSequence(new IIOImage(thumbnail, null, null), 947 tiffWriteParam); 948 949 // Insert the primary image data. 950 tiffWriter.prepareReplacePixels(0, new Rectangle(image.getWidth(), 951 image.getHeight())); 952 tiffWriter.replacePixels(image, tiffWriteParam); 953 tiffWriter.endReplacePixels(); 954 955 // End writing. 956 tiffWriter.endWriteSequence(); 957 } else { 958 // Write only the primary IFD and image data. 959 tiffWriter.write(tiffStreamMetadata, 960 new IIOImage(image, null, primaryIFD), 961 tiffWriteParam); 962 } 963 </code></pre> 964 965 <h4><a id="ExifWriteJPEG">Writing Compressed Exif Images</a></h4> 966 967 The structure of the embedded TIFF stream in the <code>APP1</code> segment of a 968 compressed Exif image is identical to the <a href="#ExifStructure"> 969 uncompressed Exif image structure</a> except that there are no primary 970 image data, i.e., the primary IFD does not refer to any image data. 971 972 <pre><code> 973 ImageWriter tiffWriter; 974 ImageWriteParam tiffWriteParam; 975 IIOMetadata tiffStreamMetadata; 976 BufferedImage image; 977 BufferedImage thumbnail; 978 IIOMetadata primaryIFD; 979 ImageOutputStream output; 980 981 // Set up an output to contain the APP1 Exif TIFF stream. 982 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 983 MemoryCacheImageOutputStream app1ExifOutput = 984 new MemoryCacheImageOutputStream(baos); 985 tiffWriter.setOutput(app1ExifOutput); 986 987 // Set compression for the thumbnail. 988 tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); 989 tiffWriteParam.setCompressionType("Exif JPEG"); 990 991 // Write the APP1 Exif TIFF stream. 992 if (thumbnail != null) { 993 // Write the TIFF header. 994 tiffWriter.prepareWriteSequence(tiffStreamMetadata); 995 996 // Append the primary IFD. 997 tiffWriter.prepareInsertEmpty(-1, // append 998 new ImageTypeSpecifier(image), 999 image.getWidth(), 1000 image.getHeight(), 1001 primaryIFD, 1002 null, // thumbnails 1003 tiffWriteParam); 1004 tiffWriter.endInsertEmpty(); 1005 1006 // Append the thumbnail IFD and image data. 1007 tiffWriter.writeToSequence(new IIOImage(thumbnail, null, 1008 null), tiffWriteParam); 1009 1010 // End writing. 1011 tiffWriter.endWriteSequence(); 1012 } else { 1013 // Write only the primary IFD. 1014 tiffWriter.prepareWriteEmpty(tiffStreamMetadata, 1015 new ImageTypeSpecifier(image), 1016 image.getWidth(), 1017 image.getHeight(), 1018 primaryIFD, 1019 null, // thumbnails 1020 tiffWriteParam); 1021 tiffWriter.endWriteEmpty(); 1022 } 1023 1024 // Flush data into byte stream. 1025 app1ExifOutput.flush(); 1026 1027 // Create APP1 parameter array. 1028 byte[] app1Parameters = new byte[6 + baos.size()]; 1029 1030 // Add APP1 Exif ID bytes. 1031 app1Parameters[0] = (byte) 'E'; 1032 app1Parameters[1] = (byte) 'x'; 1033 app1Parameters[2] = (byte) 'i'; 1034 app1Parameters[3] = (byte) 'f'; 1035 app1Parameters[4] = app1Parameters[5] = (byte) 0; 1036 1037 // Append TIFF stream to APP1 parameters. 1038 System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); 1039 1040 // Create the APP1 Exif node to be added to native JPEG image metadata. 1041 IIOMetadataNode app1Node = new IIOMetadataNode("unknown"); 1042 app1Node.setAttribute("MarkerTag", String.valueOf(0xE1)); 1043 app1Node.setUserObject(app1Parameters); 1044 1045 // Append the APP1 Exif marker to the "markerSequence" node. 1046 IIOMetadata jpegImageMetadata = 1047 jpegWriter.getDefaultImageMetadata(new ImageTypeSpecifier(image), 1048 jpegWriteParam); 1049 String nativeFormat = jpegImageMetadata.getNativeMetadataFormatName(); 1050 Node tree = jpegImageMetadata.getAsTree(nativeFormat); 1051 NodeList children = tree.getChildNodes(); 1052 int numChildren = children.getLength(); 1053 for (int i = 0; i < numChildren; i++) { 1054 Node child = children.item(i); 1055 if (child.getNodeName().equals("markerSequence")) { 1056 child.appendChild(app1Node); 1057 break; 1058 } 1059 } 1060 jpegImageMetadata.setFromTree(nativeFormat, tree); 1061 1062 // Write the JPEG image data including the APP1 Exif marker. 1063 jpegWriter.setOutput(output); 1064 jpegWriter.write(new IIOImage(image, null, jpegImageMetadata)); 1065 </code></pre> 1066 1067 The <code>"unknown"</code> node created above would be appended to the 1068 <code>"markerSequence"</code> node of the native JPEG image metadata 1069 and written to the JPEG stream when the primary image is written using 1070 the JPEG writer. 1071 1072 <h2><a id="StreamMetadata">Stream Metadata</a></h2> 1073 1074 The DTD for the TIFF native stream metadata format is as follows: 1075 1076 <pre> 1077 <!DOCTYPE "javax_imageio_tiff_stream_1.0" [ 1078 1079 <!ELEMENT "javax_imageio_tiff_stream_1.0" (ByteOrder)> 1080 1081 <!ELEMENT "ByteOrder" EMPTY> 1082 <!-- The stream byte order --> 1083 <!ATTLIST "ByteOrder" "value" #CDATA #REQUIRED> 1084 <!-- One of "BIG_ENDIAN" or "LITTLE_ENDIAN" --> 1085 <!-- Data type: String --> 1086 ]> 1087 </pre> 1088 1089 <h2><a id="ImageMetadata">Image Metadata</a></h2> 1090 1091 The DTD for the TIFF native image metadata format is as follows: 1092 1093 <pre> 1094 <!DOCTYPE "javax_imageio_tiff_image_1.0" [ 1095 1096 <!ELEMENT "javax_imageio_tiff_image_1.0" (TIFFIFD)*> 1097 1098 <!ELEMENT "TIFFIFD" (TIFFField | TIFFIFD)*> 1099 <!-- An IFD (directory) containing fields --> 1100 <!ATTLIST "TIFFIFD" "tagSets" #CDATA #REQUIRED> 1101 <!-- Data type: String --> 1102 <!ATTLIST "TIFFIFD" "parentTagNumber" #CDATA #IMPLIED> 1103 <!-- The tag number of the field pointing to this IFD --> 1104 <!-- Data type: Integer --> 1105 <!ATTLIST "TIFFIFD" "parentTagName" #CDATA #IMPLIED> 1106 <!-- A mnemonic name for the field pointing to this IFD, if known 1107 --> 1108 <!-- Data type: String --> 1109 1110 <!ELEMENT "TIFFField" (TIFFBytes | TIFFAsciis | 1111 TIFFShorts | TIFFSShorts | TIFFLongs | TIFFSLongs | 1112 TIFFRationals | TIFFSRationals | 1113 TIFFFloats | TIFFDoubles | TIFFUndefined)> 1114 <!-- A field containing data --> 1115 <!ATTLIST "TIFFField" "number" #CDATA #REQUIRED> 1116 <!-- The tag number asociated with the field --> 1117 <!-- Data type: String --> 1118 <!ATTLIST "TIFFField" "name" #CDATA #IMPLIED> 1119 <!-- A mnemonic name associated with the field, if known --> 1120 <!-- Data type: String --> 1121 1122 <!ELEMENT "TIFFBytes" (TIFFByte)*> 1123 <!-- A sequence of TIFFByte nodes --> 1124 1125 <!ELEMENT "TIFFByte" EMPTY> 1126 <!-- An integral value between 0 and 255 --> 1127 <!ATTLIST "TIFFByte" "value" #CDATA #IMPLIED> 1128 <!-- The value --> 1129 <!-- Data type: String --> 1130 <!ATTLIST "TIFFByte" "description" #CDATA #IMPLIED> 1131 <!-- A description, if available --> 1132 <!-- Data type: String --> 1133 1134 <!ELEMENT "TIFFAsciis" (TIFFAscii)*> 1135 <!-- A sequence of TIFFAscii nodes --> 1136 1137 <!ELEMENT "TIFFAscii" EMPTY> 1138 <!-- A String value --> 1139 <!ATTLIST "TIFFAscii" "value" #CDATA #IMPLIED> 1140 <!-- The value --> 1141 <!-- Data type: String --> 1142 1143 <!ELEMENT "TIFFShorts" (TIFFShort)*> 1144 <!-- A sequence of TIFFShort nodes --> 1145 1146 <!ELEMENT "TIFFShort" EMPTY> 1147 <!-- An integral value between 0 and 65535 --> 1148 <!ATTLIST "TIFFShort" "value" #CDATA #IMPLIED> 1149 <!-- The value --> 1150 <!-- Data type: String --> 1151 <!ATTLIST "TIFFShort" "description" #CDATA #IMPLIED> 1152 <!-- A description, if available --> 1153 <!-- Data type: String --> 1154 1155 <!ELEMENT "TIFFSShorts" (TIFFSShort)*> 1156 <!-- A sequence of TIFFSShort nodes --> 1157 1158 <!ELEMENT "TIFFSShort" EMPTY> 1159 <!-- An integral value between -32768 and 32767 --> 1160 <!ATTLIST "TIFFSShort" "value" #CDATA #IMPLIED> 1161 <!-- The value --> 1162 <!-- Data type: String --> 1163 <!ATTLIST "TIFFSShort" "description" #CDATA #IMPLIED> 1164 <!-- A description, if available --> 1165 <!-- Data type: String --> 1166 1167 <!ELEMENT "TIFFLongs" (TIFFLong)*> 1168 <!-- A sequence of TIFFLong nodes --> 1169 1170 <!ELEMENT "TIFFLong" EMPTY> 1171 <!-- An integral value between 0 and 4294967295 --> 1172 <!ATTLIST "TIFFLong" "value" #CDATA #IMPLIED> 1173 <!-- The value --> 1174 <!-- Data type: String --> 1175 <!ATTLIST "TIFFLong" "description" #CDATA #IMPLIED> 1176 <!-- A description, if available --> 1177 <!-- Data type: String --> 1178 1179 <!ELEMENT "TIFFSLongs" (TIFFSLong)*> 1180 <!-- A sequence of TIFFSLong nodes --> 1181 1182 <!ELEMENT "TIFFSLong" EMPTY> 1183 <!-- An integral value between -2147483648 and 2147482647 --> 1184 <!ATTLIST "TIFFSLong" "value" #CDATA #IMPLIED> 1185 <!-- The value --> 1186 <!-- Data type: String --> 1187 <!ATTLIST "TIFFSLong" "description" #CDATA #IMPLIED> 1188 <!-- A description, if available --> 1189 <!-- Data type: String --> 1190 1191 <!ELEMENT "TIFFRationals" (TIFFRational)*> 1192 <!-- A sequence of TIFFRational nodes --> 1193 1194 <!ELEMENT "TIFFRational" EMPTY> 1195 <!-- A rational value consisting of an unsigned numerator and 1196 denominator --> 1197 <!ATTLIST "TIFFRational" "value" #CDATA #IMPLIED> 1198 <!-- The numerator and denominator, separated by a slash --> 1199 <!-- Data type: String --> 1200 1201 <!ELEMENT "TIFFSRationals" (TIFFSRational)*> 1202 <!-- A sequence of TIFFSRational nodes --> 1203 1204 <!ELEMENT "TIFFSRational" EMPTY> 1205 <!-- A rational value consisting of a signed numerator and 1206 denominator --> 1207 <!ATTLIST "TIFFSRational" "value" #CDATA #IMPLIED> 1208 <!-- The numerator and denominator, separated by a slash --> 1209 <!-- Data type: String --> 1210 1211 <!ELEMENT "TIFFFloats" (TIFFFloat)*> 1212 <!-- A sequence of TIFFFloat nodes --> 1213 1214 <!ELEMENT "TIFFFloat" EMPTY> 1215 <!-- A single-precision floating-point value --> 1216 <!ATTLIST "TIFFFloat" "value" #CDATA #IMPLIED> 1217 <!-- The value --> 1218 <!-- Data type: String --> 1219 1220 <!ELEMENT "TIFFDoubles" (TIFFDouble)*> 1221 <!-- A sequence of TIFFDouble nodes --> 1222 1223 <!ELEMENT "TIFFDouble" EMPTY> 1224 <!-- A double-precision floating-point value --> 1225 <!ATTLIST "TIFFDouble" "value" #CDATA #IMPLIED> 1226 <!-- The value --> 1227 <!-- Data type: String --> 1228 1229 <!ELEMENT "TIFFUndefined" EMPTY> 1230 <!-- Uninterpreted byte data --> 1231 <!ATTLIST "TIFFUndefined" "value" #CDATA #IMPLIED> 1232 <!-- A list of comma-separated byte values --> 1233 <!-- Data type: String --> 1234 ]> 1235 </pre> 1236 1237 @since 9 1238 </main> 1239 </body> 1240 </html>