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 <div class="contentContainer"> 35 <h1>TIFF Metadata Format Specification and Usage Notes</h1> 36 37 <a href="#Reading">Reading Images</a> 38 <ul> 39 <li><a href="#ColorConversionRead">Color Conversion</a></li> 40 <li><a href="#ColorSpacesRead">Color Spaces</a></li> 41 <li><a href="#ICCProfilesRead">ICC Profiles</a></li> 42 <li><a href="#MetadataIssuesRead">Metadata Issues</a> 43 <ul> 44 <li><a href="#MapNativeStandard">Native to Standard Metadata Mapping</a></li> 45 </ul> 46 </li> 47 <li><a href="#ExifRead">Reading Exif Images</a> 48 <ul> 49 <li><a href="#ExifReadTIFF">Reading Uncompressed Exif Images</a></li> 50 <li><a href="#ExifReadJPEG">Reading Compressed Exif Images</a></li> 51 </ul> 52 </li> 53 </ul> 54 <a href="#Writing">Writing Images</a><br/> 55 <ul> 56 <li><a href="#Compression">Compression</a></li> 57 <li><a href="#ColorConversionWrite">Color Conversion</a></li> 58 <li><a href="#ICCProfilesWrite">ICC Profiles</a></li> 59 <li><a href="#MetadataIssuesWrite">Metadata Issues</a> 60 <ul> 61 <li><a href="#MapStandardNative">Standard to Native Metadata Mapping</a></li> 62 </ul> 63 <li><a href="#ExifWrite">Writing Exif Images</a> 64 <ul> 65 <li><a href="#ExifWriteTIFF">Writing Uncompressed Exif Images</a></li> 66 <li><a href="#ExifWriteJPEG">Writing Compressed Exif Images</a></li> 67 </ul> 68 </li> 69 </ul> 70 <a href="#StreamMetadata">Native Stream Metadata Format</a><br/> 71 <a href="#ImageMetadata">Native Image Metadata Format</a> 72 73 <h2><a id="Reading">Reading Images</a></h2> 74 75 TIFF images are read by an <a href="../../ImageReader.html">ImageReader</a> 76 which may be controlled by its public interface as well as via a supplied 77 <a href="../../plugins/tiff/TIFFImageReadParam.html">TIFFImageReadParam</a>. 78 79 <!-- <h3>Supported Image Types</h3> --> 80 81 <!-- Table? --> 82 83 <h3><a id="ColorConversionRead">Color Conversion</a></h3> 84 85 <p>If the source image data 86 have photometric type CIE L*a*b* or YCbCr, and the destination color space 87 type is RGB, then the source image data will be automatically converted to 88 RGB using an internal color converter.</p> 89 90 <h3><a id="ColorSpacesRead">Color Spaces</a></h3> 91 92 The raw color space assigned by default, i.e., in the absence of a 93 user-supplied <a href="../../ImageTypeSpecifier.html">ImageTypeSpecifier</a>, 94 will be the first among the following which applies: 95 96 <ul> 97 <li>A color space created from the <a href="#ICCProfilesRead">ICC Profile</a> 98 metadata field if it is present and compatible with the image data 99 layout.</li> 100 <li><a id="nonICCProfile"></a>sRGB if the image is monochrome/bilevel 101 (a two-level color map is created internally).</li> 102 <li>sRGB if the image is palette-color.</li> 103 <li>Linear RGB if the image has three samples per pixel, has photometric type 104 CIE L*a*b*, or has photometric type YCbCr and is <i>not</i> 105 JPEG-compressed.</li> 106 <li>A <a href="#DefaultCMYK">default CMYK color space</a> if the image has 107 photometric type CMYK and four samples per pixel.</li> 108 <li>Grayscale if the image has one or two samples per pixel and uniformly 109 1, 2, 4, 8, 16, or 32 bits per sample or is floating point.</li> 110 <li>sRGB if the image has three or four samples per pixel and uniformly 111 1, 2, 4, 8, 16, or 32 bits per sample or is floating point.</li> 112 <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image 113 has more than four samples per pixel and the number of bits per sample for 114 all bands is the same and is a multiple of 8.</li> 115 <li>Grayscale if the image has one or two samples per pixel regardless of 116 the number of bits per sample.</li> 117 <li>sRGB if the image has three or four samples per pixel regardless of 118 the number of bits per sample.</li> 119 <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image 120 has more than four samples per pixel regardless of the number of bits per 121 sample.</li> 122 </ul> 123 124 <p><a id="DefaultCMYK"></a>The normalized color coordinate transformations 125 used for the default CMYK color space are defined as follows: 126 127 <ul> 128 <li>CMYK to linear RGB 129 <pre> 130 R = (1 - K)*(1 - C) 131 G = (1 - K)*(1 - M) 132 B = (1 - K)*(1 - Y) 133 </pre> 134 </li> 135 <li>Linear RGB to CMYK 136 <pre> 137 K = min{1 - R, 1 - G, 1 - B} 138 if(K != 1) { 139 C = (1 - R - K)/(1 - K) 140 M = (1 - G - K)/(1 - K) 141 Y = (1 - B - K)/(1 - K) 142 } else { 143 C = M = Y = 0 144 } 145 </pre> 146 </li> 147 </ul> 148 149 <p><a id="GenericCS"></a>The generic color space used when no other color space 150 can be inferred is provided merely to enable the data to be loaded. It is not 151 intended to provide accurate conversions of any kind.</p> 152 153 <p>If the data are known to be in a color space not correctly handled by the 154 foregoing, then an <code>ImageTypeSpecifier</code> should be 155 supplied to the reader and should be derived from a color space which is correct 156 for the data in question.</p> 157 158 <h3><a id="ICCProfilesRead">ICC Profiles</a></h3> 159 160 If an ICC profile is contained in the image metadata 161 (<a href="../../plugins/tiff/BaselineTIFFTagSet.html"> 162 BaselineTIFFTagSet</a>.TAG_ICC_PROFILE, tag number 34675), 163 an attempt will be made to use it to create the color space 164 of the loaded image. It will be used if the data layout is of component type 165 and the number of samples per pixel equals or is one greater than the number 166 of components described by the ICC profile. If the ICC profile is not used 167 then the color space will be inferred in one of the subsequent steps described 168 <a href="#nonICCProfile">above</a>. 169 170 <p>If for some reason the embedded ICC profile is not used automatically, then 171 it may be used manually by following this procedure: 172 173 <ol> 174 <li>Obtain the image metadata from 175 <code>ImageReader.getImageMetadata</code></li> 176 <li>Extract the ICC profile field and its value.</li> 177 <li>Create an <a href="../../../../java/awt/color/ICC_ColorSpace.html"> 178 ICC_ColorSpace</a> from an 179 <a href="../../../../java/awt/color/ICC_Profile.html"> 180 ICC_Profile</a> created from the ICC profile field data 181 using <code>ICC_Profile.getInstance(byte[])</code>.</li> 182 <li>Create an <code>ImageTypeSpecifier</code> from the new color 183 space using one of its factory methods which accepts an 184 <code>ICC_ColorSpace</code>. 185 <li>Create a compatible <a href="../../ImageReadParam.html">ImageReadParam</a> 186 and set the <code>ImageTypeSpecifier</code> using 187 <code>ImageReadParam.setDestinationType</code>.</li> 188 <li>Pass the parameter object to the appropriate <code>read</code> method.</li> 189 </ol> 190 191 <p>If the inferred color space not based on the ICC Profile field is compatible 192 with the ICC profile-based color space, then a second 193 <code>ImageTypeSpecifier</code> derived from this inferred color 194 space will be included in the 195 {@link java.util.Iterator Iterator} returned by 196 <code>ImageReader.getImageTypes</code>. If the iterator contains 197 more than one type, the first one will be based on the ICC profile and the 198 second on the inferred color space.</p> 199 200 <h3><a id="MetadataIssuesRead">Metadata Issues</a></h3> 201 202 By default all recognized fields in the TIFF image file directory (IFD) are 203 loaded into the native image metadata object. Which fields are loaded may be 204 controlled by setting which TIFF tags the reader is allowed to recognize, 205 whether to read fields with unrecognized tags, and whether to ignore all 206 metadata. The reader is informed to disregard all metadata as usual via the 207 <code>ignoreMetadata</code> parameter of 208 <code>ImageReader.setInput(Object,boolean,boolean)</code>. It is 209 informed of which <a href="../../plugins/tiff/TIFFTag.html">TIFFTag</a>s to 210 recognize or not to recognize via 211 <code>TIFFImageReadParam.addAllowedTagSet(TIFFTagSet)</code> and 212 <code>TIFFImageReadParam.removeAllowedTagSet(TIFFTagSet)</code>. 213 If <code>ignoreMetadata</code> is <code>true</code>, then only metadata 214 essential to reading the image will be loaded into the native image metadata 215 object. If <code>ignoreMetadata</code> is <code>false</code>, then the reader 216 will by default load into the native image metadata object only those fields 217 which are either essential to reading the image or have a <code>TIFFTag</code> 218 contained in the one of the allowed <code>TIFFTagSet</code>s. Reading of 219 fields with tags not in the allowed <code>TIFFTagSet</code>s may be forced 220 by passing in a <code>TIFFImageReadParam</code> on which 221 <code>TIFFImageReadParam.setReadUnknownTags(boolean)</code> has been 222 invoked with parameter <code>true</code>. 223 224 <p>Use of a <a href="../../plugins/tiff/TIFFDirectory.html">TIFFDirectory</a> 225 object may simplify gaining access to metadata values. An instance of 226 <code>TIFFDirectory</code> may be created from the <code>IIOMetadata</code> 227 object returned by the TIFF reader using the 228 <code>TIFFDirectory.createFromMetadata</code> method.</p> 229 230 <h4><a id="MapNativeStandard"></a> 231 Mapping of TIFF Native Image Metadata to the Standard Metadata Format</h4> 232 233 <table border="1"> 234 <caption>The derivation of standard metadata format 235 <a href="standard_metadata.html">javax_imageio_1.0</a> 236 elements from <a href="#ImageMetadata">TIFF native image metadata</a> is given 237 in the following table.</caption> 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> 525 </tr> 526 </thead> 527 <tbody> 528 <tr> 529 <th scope="row">1</th> 530 <td>CCITT RLE</td> 531 <td>Modified Huffman compression</td> 532 <td>TIFF 6.0 Specification, Section 10</td> 533 </tr> 534 <tr> 535 <th scope="row">2</th> 536 <td>CCITT T.4</td> 537 <td>CCITT T.4 bilevel encoding/Group 3 facsimile compression</td> 538 <td>TIFF 6.0 Specification, Section 11</td> 539 </tr> 540 <tr> 541 <th scope="row">3</th> 542 <td>CCITT T.6</td> 543 <td>CCITT T.6 bilevel encoding/Group 4 facsimile compression</td> 544 <td>TIFF 6.0 Specification, Section 11</td></tr> 545 <tr> 546 <th scope="row">4</th> 547 <td>LZW</td> 548 <td>LZW compression</td> 549 <td>TIFF 6.0 Specification, Section 13</td></tr> 550 <tr> 551 <th scope="row">5</th> 552 <td>JPEG</td> 553 <td>"New" JPEG-in-TIFF compression</td> 554 <td>TIFF Technical Note #2</td></tr> 555 <tr> 556 <th scope="row">6</th> 557 <td>ZLib</td> 558 <td>"Deflate/Inflate" compression (see note following this table)</td> 559 <td>Adobe Photoshop® TIFF Technical Notes</td> 560 </tr> 561 <tr> 562 <th scope="row">7</th> 563 <td>PackBits</td> 564 <td>Byte-oriented, run length compression</td> 565 <td>TIFF 6.0 Specification, Section 9</td> 566 </tr> 567 <tr> 568 <th scope="row">8</th> 569 <td>Deflate</td> 570 <td>"Zip-in-TIFF" compression (see note following this table)</td> 571 <td><a href="https://tools.ietf.org/html/rfc1950"> 572 ZLIB Compressed Data Format Specification</a>, 573 <a href="https://tools.ietf.org/html/rfc1951"> 574 DEFLATE Compressed Data Format Specification</a></td> 575 </tr> 576 <tr> 577 <th scope="row">9</th> 578 <td>Exif JPEG</td> 579 <td>Exif-specific JPEG compression (see note following this table)</td> 580 <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a> 581 (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td> 582 </tbody> 583 </table> 584 585 <p> 586 Old-style JPEG compression as described in section 22 of the TIFF 6.0 587 Specification is <i>not</i> supported. 588 </p> 589 590 <p> The CCITT compression types are applicable to bilevel (1-bit) 591 images only. The JPEG compression type is applicable to byte 592 grayscale (1-band) and RGB (3-band) images only.</p> 593 594 <p> 595 ZLib and Deflate compression are identical except for the value of the 596 TIFF Compression field: for ZLib the Compression field has value 8 597 whereas for Deflate it has value 32946 (0x80b2). In both cases each 598 image segment (strip or tile) is written as a single complete zlib data 599 stream. 600 </p> 601 602 <p> 603 "Exif JPEG" is a compression type used when writing the contents of an 604 APP1 Exif marker segment for inclusion in a JPEG native image metadata 605 tree. The contents appended to the output when this compression type is 606 used are a function of whether an empty or non-empty image is written. 607 If the image is empty, then a TIFF IFD adhering to the specification of 608 a compressed Exif primary IFD is appended. If the image is non-empty, 609 then a complete IFD and image adhering to the specification of a 610 compressed Exif thumbnail IFD and image are appended. Note that the 611 data of the empty image may <i>not</i> later be appended using the pixel 612 replacement capability of the TIFF writer. 613 </p> 614 615 <p> If ZLib/Deflate or JPEG compression is used, the compression quality 616 may be set. For ZLib/Deflate the supplied floating point quality value is 617 rescaled to the range <code>[1, 9]</code> and truncated to an integer 618 to derive the Deflate compression level. For JPEG the floating point 619 quality value is passed directly to the JPEG writer plug-in which 620 interprets it in the usual way.</p> 621 622 <h3><a id="ColorConversionWrite">Color Conversion</a></h3> 623 624 <p>If the source image data 625 color space type is RGB, and the destination photometric type is CIE L*a*b* or 626 YCbCr, then the source image data will be automatically converted from 627 RGB using an internal color converter.</p> 628 629 <h3><a id="ICCProfilesWrite">ICC Profiles</a></h3> 630 631 An <code>ICC Profile</code> field will be written if either: 632 <ul> 633 <li>one is present in the native image metadata 634 <a href="../IIOMetadata.html">IIOMetadata</a> instance supplied to the writer, 635 or</li> 636 <li>the <a href="../../../../java/awt/color/ColorSpace.html">ColorSpace</a> 637 of the destination <code>ImageTypeSpecifier</code> is an instance of 638 <code>ICC_ColorSpace</code> which is not one of the standard 639 color spaces defined by the <code>CS_*</code> constants in the 640 <code>ColorSpace</code> class. The destination type is set via 641 <code>ImageWriteParam.setDestinationType(ImageTypeSpecifier)</code> and defaults 642 to the <code>ImageTypeSpecifier</code> of the image being written. 643 </li> 644 </ul> 645 646 <h3><a id="MetadataIssuesWrite">Metadata Issues</a></h3> 647 648 Some behavior of the writer is affected by or may affect the contents of 649 the image metadata which may be supplied by the user. 650 651 <p>For bilevel images, the <code>FillOrder</code>, and <code>T4Options</code> 652 fields affect the output data. The data will be filled right-to-left if 653 <code>FillOrder</code> is present with a value of 2 654 (<code>BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT</code>) 655 and will be filled left-to-right otherwise. The value of <code>T4Options</code> 656 specifies whether the data should be 1D- or 2D-encoded and whether EOL 657 padding should be used.</p> 658 659 <p>For all images the value of the <code>RowsPerStrip</code> field is used 660 to the set the number of rows per strip if the image is not tiled. The 661 default number of rows per strip is either 8 or the number of rows which 662 would fill no more than 8 kilobytes, whichever is larger.</p> 663 664 <p>For all images the tile dimensions may be set using the <code>TileWidth</code> 665 and <code>TileLength</code> field values if the tiling mode is 666 <code>ImageWriteParam.MODE_COPY_FROM_METADATA</code>. If this mode 667 is set but the fields are not, their respective default values are the image 668 width and height.</p> 669 670 <p>When using JPEG-in-TIFF compression, a <code>JPEGTables</code> field will be 671 written to the IFD and abbreviated JPEG streams to each strip or tile if and 672 only if a <code>JPEGTables</code> field is contained in the metadata object 673 provided to the writer. If the contents of the <code>JPEGTables</code> field is 674 a valid tables-only JPEG stream, then it will be used; otherwise the contents 675 of the field will be replaced with default visually lossless tables. If no 676 such <code>JPEGTables</code> field is present in the metadata, then no 677 <code>JPEGTables</code> field will be written to the output and each strip or 678 tile will be written as a separate, self-contained JPEG stream.</p> 679 680 <p>When using Deflate/ZLib or LZW compression, if the image has 8 bits per 681 sample, a horizontal differencing predictor will be used if the 682 <code>Predictor</code> field is present with a value of 2 683 (<code>BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING</code>). 684 If prediction is so requested but the image does not have 685 8 bits per sample the field will be reset to have the value 1 686 (<code>BaselineTIFFTagSet.PREDICTOR_NONE</code>). 687 </p> 688 689 <p>Some fields may be added or modified: 690 691 <ul> 692 <li><code>PhotometricInterpretation</code> if not present.</li> 693 <li><code>PlanarConfiguration</code> if this field is present with value 694 <code>Planar</code> is is reset to <code>Chunky</code>.</li> 695 <li><code>Compression</code> always.</li> 696 <li><code>BitsPerSample</code> if the image is not bilevel.</li> 697 <li><code>SamplesPerPixel</code> always.</li> 698 <li><code>ExtraSamples</code> if an alpha channel is present.</li> 699 <li><code>SampleFormat</code> if not present and the data are 16- or 32-bit 700 integers or floating point.</li> 701 <li><code>ColorMap</code> if the <code>PhotometricInterpretation</code> is 702 <code>RGBPalette</code>.</li> 703 <li><code>ImageWidth</code> and <code>ImageLength</code> always.</li> 704 <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and 705 <code>TileByteCounts</code> if a tiled image is being written.</li> 706 <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> 707 if a tiled image is <i>not</i> being written.</li> 708 <li><code>XResolution</code>, <code>YResolution</code>, and <code>ResolutionUnit</code> 709 if none of these is present.</li> 710 <li><code>YCbCrSubsampling</code> and <code>YCbCrPositioning</code> if the 711 photometric interpretation is YCbCr and the compression type is not JPEG 712 (only [1, 1] subsampling and cosited positioning are supported for 713 non-JPEG YCbCr output).</li> 714 <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and 715 <code>ReferenceBlackWhite</code>: if the compression type is JPEG and the color 716 space is RGB these will be reset to [2, 2] centered subsampling with no 717 headroom/footroom (0:255,128:255,128:255).</li> 718 </ul> 719 720 <p>Some fields may be removed: 721 722 <ul> 723 <li><code>BitsPerSample</code> if the image is bilevel.</li> 724 <li><code>ExtraSamples</code> if the image does not have an alpha channel.</li> 725 <li><code>ColorMap</code> if the photometric interpretation is not 726 <code>RGBPalette</code>.</li> 727 <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and 728 <code>TileByteCounts</code> if tiling <i>is not</i> being used.</li> 729 <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> 730 if tiling <i>is</i> being used.</li> 731 <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and 732 <code>ReferenceBlackWhite</code> if the compression type is JPEG and the 733 color space is grayscale.</li> 734 <li><code>JPEGProc</code>, <code>JPEGInterchangeFormat</code>, 735 <code>JPEGInterchangeFormatLength</code>, <code>JPEGRestartInterval</code>, 736 <code>JPEGLosslessPredictors</code>, <code>JPEGPointTransforms</code>, 737 <code>JPEGQTables</code>, <code>JPEGDCTables</code>, and 738 <code>JPEGACTables</code> if the compression type is JPEG.</li> 739 </ul> 740 741 <p>Other fields present in the supplied metadata are uninterpreted and will 742 be written as supplied.</p> 743 744 <p>If an Exif image is being written, the set of fields present and their 745 values will be modified such that the result is in accord with the Exif 2.2 746 specification.</p> 747 748 <p>Setting up the image metadata to write to a TIFF stream may be simplified 749 by using the <code>TIFFDirectory</code> class 750 which represents a TIFF IFD. A field in a TIFF IFD is represented by an 751 instance of <a href="../../plugins/tiff/TIFFField.html">TIFFField</a>. For each 752 field to be written a <code>TIFFField</code> may be added to the 753 <code>TIFFDirectory</code> and the latter converted to an 754 <code>IIOMetadata</code> object by invoking 755 <code>TIFFDirectory.getAsMetadata</code>. The 756 <code>IIOMetadata</code> object so obtained may then be passed to the TIFF 757 writer.</p> 758 759 <h4><a id="MapStandardNative"></a> 760 Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h4> 761 762 763 <table border="1"> 764 <caption>The derivation of <a href="#ImageMetadata">TIFF native image metadata</a> 765 elements from the standard metadata format 766 <a href="standard_metadata.html">javax_imageio_1.0</a> is 767 given in the following table.</caption> 768 <thead> 769 <tr> 770 <th scope="col">Index</th> 771 <th scope="col">TIFF Field</th> 772 <th scope="col">Derivation from Standard Metadata Elements</th> 773 </tr> 774 </thead> 775 <tbody> 776 <tr> 777 <th scope="row">1</th> 778 <td> 779 PhotometricInterpretation 780 </td> 781 <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE" 782 => WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value = 783 "TransparencyMask" => TransparencyMask; "RGB" and /Chroma/Palette present => 784 PaletteColor; "GRAY" => BlackIsZero; "RGB" => RGB; "YCbCr" => YCbCr; 785 "CMYK" => CMYK; "Lab" => CIELab.</td> 786 </tr> 787 <tr> 788 <th scope="row">2</th> 789 <td>SamplesPerPixel</td> 790 <td>/Chroma/NumChannels@value</td> 791 </tr> 792 <tr> 793 <th scope="row">3</th> 794 <td>ColorMap</td> 795 <td>/Chroma/Palette</td> 796 </tr> 797 <tr> 798 <th scope="row">4</th> 799 <td>Compression</td> 800 <td>/Compression/CompressionTypeName@value: "none" => Uncompressed; 801 "CCITT RLE" => CCITT 1D; "CCITT T.4" => Group 3 Fax; "CCITT T.6" => Group 4 802 Fax; "LZW" => LZW; "Old JPEG" => JPEG; "JPEG" => New JPEG; "ZLib" => ZLib; 803 "PackBits" => PackBits; "Deflate" => Deflate.</td> 804 </tr> 805 <tr> 806 <th scope="row">5</th> 807 <td>PlanarConfiguration</td> 808 <td>/Data/PlanarConfiguration@value: "PixelInterleaved" => Chunky; 809 "PlaneInterleaved" => Planar.</td> 810 </tr> 811 <tr> 812 <th scope="row">6</th> 813 <td>SampleFormat</td> 814 <td>/Data/SampleFormat@value: "SignedIntegral" => two's complement signed 815 integer data; "UnsignedIntegral" => unsigned integer data; "Real" => 816 IEEE floating point data; "Index" => unsigned integer data. 817 </td> 818 </tr> 819 <tr> 820 <th scope="row">7</th> 821 <td>BitsPerSample</td> 822 <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td> 823 </tr> 824 <tr> 825 <th scope="row">8</th> 826 <td>FillOrder</td> 827 <td>/Data/SampleMSB@value: if all values in space-separated list are 0s => 828 right-to-left; otherwise => left-to-right. 829 </td> 830 </tr> 831 <tr> 832 <th scope="row">9</th> 833 <td>XResolution</td> 834 <td>(10 / /Dimension/HorizontalPixelSize@value) or 835 (10 / (/Dimension/VerticalPixelSize@value * 836 /Dimension/PixelAspectRatio@value))</td> 837 </tr> 838 <tr> 839 <th scope="row">10</th> 840 <td>YResolution</td> 841 <td>(10 / /Dimension/VerticalPixelSize@value) or 842 (10 / (/Dimension/HorizontalPixelSize@value / 843 /Dimension/PixelAspectRatio@value))</td> 844 </tr> 845 <tr> 846 <th scope="row">11</th> 847 <td>ResolutionUnit</td> 848 <td>Centimeter if XResolution or YResolution set; otherwise None.</td> 849 </tr> 850 <tr> 851 <th scope="row">12</th> 852 <td>Orientation</td> 853 <td>/Dimension/ImageOrientation@value</td> 854 </tr> 855 <tr> 856 <th scope="row">13</th> 857 <td>XPosition</td> 858 <td>/Dimension/HorizontalPosition@value / 10</td> 859 </tr> 860 <tr> 861 <th scope="row">14</th> 862 <td>YPosition</td> 863 <td>/Dimension/VerticalPosition@value / 10</td> 864 </tr> 865 <tr> 866 <th scope="row">15</th> 867 <td>NewSubFileType</td> 868 <td>/Document/SubimageInterpretation@value: "TransparencyMask" => 869 transparency mask; "ReducedResolution" => reduced-resolution; 870 "SinglePage" => single page.</td> 871 </tr> 872 <tr> 873 <th scope="row">16</th> 874 <td>DateTime</td> 875 <td>/Document/ImageCreationTime@value</td> 876 </tr> 877 <tr> 878 <th scope="row">17</th> 879 <td>DocumentName, ImageDescription, Make, Model, PageName, Software, 880 Artist, HostComputer, InkNames, Copyright</td> 881 <td>/Text/TextEntry: if /Text/TextEntry@keyword is the name of any of the 882 TIFF Fields, e.g., "Software", then the field is added with content 883 /Text/TextEntry@value and count 1.</td> 884 </tr> 885 <tr> 886 <th scope="row">18</th> 887 <td>ExtraSamples</td> 888 <td>/Transparency/Alpha@value: "premultiplied" => associated alpha, count 1; 889 "nonpremultiplied" => unassociated alpha, count 1.</td> 890 </tr> 891 </tbody> 892 </table> 893 894 <h3><a id="ExifWrite">Writing Exif Images</a></h3> 895 896 The TIFF writer may be used to write an uncompressed Exif image or the 897 contents of the <code>APP1</code> marker segment of a compressed Exif image. 898 899 <h4><a id="ExifWriteTIFF">Writing Uncompressed Exif Images</a></h4> 900 901 When writing a sequence of images each image is normally recorded as 902 {IFD, IFD Value, Image Data}. The Exif specification requires 903 that an uncompressed Exif image be structured as follows: 904 905 <a id="ExifStructure"></a> 906 <ol> 907 <li>Image File Header</li> 908 <li>Primary IFD</li> 909 <li>Primary IFD Value</li> 910 <li>Thumbnail IFD</li> 911 <li>Thumbnail IFD Value</li> 912 <li>Thumbnail Image Data</li> 913 <li>Primary Image Data</li> 914 </ol> 915 916 To meet the requirement of the primary image data being recorded last, the 917 primary image must be written initially as an empty image and have its data 918 added via pixel replacement after the thumbnail IFD and image data have been 919 written: 920 921 <pre><code> 922 ImageWriter tiffWriter; 923 ImageWriteParam tiffWriteParam; 924 IIOMetadata tiffStreamMetadata; 925 IIOMetadata primaryIFD; 926 BufferedImage image; 927 BufferedImage thumbnail; 928 929 // Specify uncompressed output. 930 tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED); 931 932 if (thumbnail != null) { 933 // Write the TIFF header. 934 tiffWriter.prepareWriteSequence(tiffStreamMetadata); 935 936 // Append the primary IFD. 937 tiffWriter.prepareInsertEmpty(-1, // append 938 new ImageTypeSpecifier(image), 939 image.getWidth(), 940 image.getHeight(), 941 primaryIFD, 942 null, // thumbnails 943 tiffWriteParam); 944 tiffWriter.endInsertEmpty(); 945 946 // Append the thumbnail image data. 947 tiffWriter.writeToSequence(new IIOImage(thumbnail, null, null), 948 tiffWriteParam); 949 950 // Insert the primary image data. 951 tiffWriter.prepareReplacePixels(0, new Rectangle(image.getWidth(), 952 image.getHeight())); 953 tiffWriter.replacePixels(image, tiffWriteParam); 954 tiffWriter.endReplacePixels(); 955 956 // End writing. 957 tiffWriter.endWriteSequence(); 958 } else { 959 // Write only the primary IFD and image data. 960 tiffWriter.write(tiffStreamMetadata, 961 new IIOImage(image, null, primaryIFD), 962 tiffWriteParam); 963 } 964 </code></pre> 965 966 <h4><a id="ExifWriteJPEG">Writing Compressed Exif Images</a></h4> 967 968 The structure of the embedded TIFF stream in the <code>APP1</code> segment of a 969 compressed Exif image is identical to the <a href="#ExifStructure"> 970 uncompressed Exif image structure</a> except that there are no primary 971 image data, i.e., the primary IFD does not refer to any image data. 972 973 <pre><code> 974 ImageWriter tiffWriter; 975 ImageWriteParam tiffWriteParam; 976 IIOMetadata tiffStreamMetadata; 977 BufferedImage image; 978 BufferedImage thumbnail; 979 IIOMetadata primaryIFD; 980 ImageOutputStream output; 981 982 // Set up an output to contain the APP1 Exif TIFF stream. 983 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 984 MemoryCacheImageOutputStream app1ExifOutput = 985 new MemoryCacheImageOutputStream(baos); 986 tiffWriter.setOutput(app1ExifOutput); 987 988 // Set compression for the thumbnail. 989 tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); 990 tiffWriteParam.setCompressionType("Exif JPEG"); 991 992 // Write the APP1 Exif TIFF stream. 993 if (thumbnail != null) { 994 // Write the TIFF header. 995 tiffWriter.prepareWriteSequence(tiffStreamMetadata); 996 997 // Append the primary IFD. 998 tiffWriter.prepareInsertEmpty(-1, // append 999 new ImageTypeSpecifier(image), 1000 image.getWidth(), 1001 image.getHeight(), 1002 primaryIFD, 1003 null, // thumbnails 1004 tiffWriteParam); 1005 tiffWriter.endInsertEmpty(); 1006 1007 // Append the thumbnail IFD and image data. 1008 tiffWriter.writeToSequence(new IIOImage(thumbnail, null, 1009 null), tiffWriteParam); 1010 1011 // End writing. 1012 tiffWriter.endWriteSequence(); 1013 } else { 1014 // Write only the primary IFD. 1015 tiffWriter.prepareWriteEmpty(tiffStreamMetadata, 1016 new ImageTypeSpecifier(image), 1017 image.getWidth(), 1018 image.getHeight(), 1019 primaryIFD, 1020 null, // thumbnails 1021 tiffWriteParam); 1022 tiffWriter.endWriteEmpty(); 1023 } 1024 1025 // Flush data into byte stream. 1026 app1ExifOutput.flush(); 1027 1028 // Create APP1 parameter array. 1029 byte[] app1Parameters = new byte[6 + baos.size()]; 1030 1031 // Add APP1 Exif ID bytes. 1032 app1Parameters[0] = (byte) 'E'; 1033 app1Parameters[1] = (byte) 'x'; 1034 app1Parameters[2] = (byte) 'i'; 1035 app1Parameters[3] = (byte) 'f'; 1036 app1Parameters[4] = app1Parameters[5] = (byte) 0; 1037 1038 // Append TIFF stream to APP1 parameters. 1039 System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); 1040 1041 // Create the APP1 Exif node to be added to native JPEG image metadata. 1042 IIOMetadataNode app1Node = new IIOMetadataNode("unknown"); 1043 app1Node.setAttribute("MarkerTag", String.valueOf(0xE1)); 1044 app1Node.setUserObject(app1Parameters); 1045 1046 // Append the APP1 Exif marker to the "markerSequence" node. 1047 IIOMetadata jpegImageMetadata = 1048 jpegWriter.getDefaultImageMetadata(new ImageTypeSpecifier(image), 1049 jpegWriteParam); 1050 String nativeFormat = jpegImageMetadata.getNativeMetadataFormatName(); 1051 Node tree = jpegImageMetadata.getAsTree(nativeFormat); 1052 NodeList children = tree.getChildNodes(); 1053 int numChildren = children.getLength(); 1054 for (int i = 0; i < numChildren; i++) { 1055 Node child = children.item(i); 1056 if (child.getNodeName().equals("markerSequence")) { 1057 child.appendChild(app1Node); 1058 break; 1059 } 1060 } 1061 jpegImageMetadata.setFromTree(nativeFormat, tree); 1062 1063 // Write the JPEG image data including the APP1 Exif marker. 1064 jpegWriter.setOutput(output); 1065 jpegWriter.write(new IIOImage(image, null, jpegImageMetadata)); 1066 </code></pre> 1067 1068 The <code>"unknown"</code> node created above would be appended to the 1069 <code>"markerSequence"</code> node of the native JPEG image metadata 1070 and written to the JPEG stream when the primary image is written using 1071 the JPEG writer. 1072 1073 <h2><a id="StreamMetadata">Stream Metadata</a></h2> 1074 1075 The DTD for the TIFF native stream metadata format is as follows: 1076 1077 <pre> 1078 <!DOCTYPE "javax_imageio_tiff_stream_1.0" [ 1079 1080 <!ELEMENT "javax_imageio_tiff_stream_1.0" (ByteOrder)> 1081 1082 <!ELEMENT "ByteOrder" EMPTY> 1083 <!-- The stream byte order --> 1084 <!ATTLIST "ByteOrder" "value" #CDATA #REQUIRED> 1085 <!-- One of "BIG_ENDIAN" or "LITTLE_ENDIAN" --> 1086 <!-- Data type: String --> 1087 ]> 1088 </pre> 1089 1090 <h2><a id="ImageMetadata">Image Metadata</a></h2> 1091 1092 The DTD for the TIFF native image metadata format is as follows: 1093 1094 <pre> 1095 <!DOCTYPE "javax_imageio_tiff_image_1.0" [ 1096 1097 <!ELEMENT "javax_imageio_tiff_image_1.0" (TIFFIFD)*> 1098 1099 <!ELEMENT "TIFFIFD" (TIFFField | TIFFIFD)*> 1100 <!-- An IFD (directory) containing fields --> 1101 <!ATTLIST "TIFFIFD" "tagSets" #CDATA #REQUIRED> 1102 <!-- Data type: String --> 1103 <!ATTLIST "TIFFIFD" "parentTagNumber" #CDATA #IMPLIED> 1104 <!-- The tag number of the field pointing to this IFD --> 1105 <!-- Data type: Integer --> 1106 <!ATTLIST "TIFFIFD" "parentTagName" #CDATA #IMPLIED> 1107 <!-- A mnemonic name for the field pointing to this IFD, if known 1108 --> 1109 <!-- Data type: String --> 1110 1111 <!ELEMENT "TIFFField" (TIFFBytes | TIFFAsciis | 1112 TIFFShorts | TIFFSShorts | TIFFLongs | TIFFSLongs | 1113 TIFFRationals | TIFFSRationals | 1114 TIFFFloats | TIFFDoubles | TIFFUndefined)> 1115 <!-- A field containing data --> 1116 <!ATTLIST "TIFFField" "number" #CDATA #REQUIRED> 1117 <!-- The tag number asociated with the field --> 1118 <!-- Data type: String --> 1119 <!ATTLIST "TIFFField" "name" #CDATA #IMPLIED> 1120 <!-- A mnemonic name associated with the field, if known --> 1121 <!-- Data type: String --> 1122 1123 <!ELEMENT "TIFFBytes" (TIFFByte)*> 1124 <!-- A sequence of TIFFByte nodes --> 1125 1126 <!ELEMENT "TIFFByte" EMPTY> 1127 <!-- An integral value between 0 and 255 --> 1128 <!ATTLIST "TIFFByte" "value" #CDATA #IMPLIED> 1129 <!-- The value --> 1130 <!-- Data type: String --> 1131 <!ATTLIST "TIFFByte" "description" #CDATA #IMPLIED> 1132 <!-- A description, if available --> 1133 <!-- Data type: String --> 1134 1135 <!ELEMENT "TIFFAsciis" (TIFFAscii)*> 1136 <!-- A sequence of TIFFAscii nodes --> 1137 1138 <!ELEMENT "TIFFAscii" EMPTY> 1139 <!-- A String value --> 1140 <!ATTLIST "TIFFAscii" "value" #CDATA #IMPLIED> 1141 <!-- The value --> 1142 <!-- Data type: String --> 1143 1144 <!ELEMENT "TIFFShorts" (TIFFShort)*> 1145 <!-- A sequence of TIFFShort nodes --> 1146 1147 <!ELEMENT "TIFFShort" EMPTY> 1148 <!-- An integral value between 0 and 65535 --> 1149 <!ATTLIST "TIFFShort" "value" #CDATA #IMPLIED> 1150 <!-- The value --> 1151 <!-- Data type: String --> 1152 <!ATTLIST "TIFFShort" "description" #CDATA #IMPLIED> 1153 <!-- A description, if available --> 1154 <!-- Data type: String --> 1155 1156 <!ELEMENT "TIFFSShorts" (TIFFSShort)*> 1157 <!-- A sequence of TIFFSShort nodes --> 1158 1159 <!ELEMENT "TIFFSShort" EMPTY> 1160 <!-- An integral value between -32768 and 32767 --> 1161 <!ATTLIST "TIFFSShort" "value" #CDATA #IMPLIED> 1162 <!-- The value --> 1163 <!-- Data type: String --> 1164 <!ATTLIST "TIFFSShort" "description" #CDATA #IMPLIED> 1165 <!-- A description, if available --> 1166 <!-- Data type: String --> 1167 1168 <!ELEMENT "TIFFLongs" (TIFFLong)*> 1169 <!-- A sequence of TIFFLong nodes --> 1170 1171 <!ELEMENT "TIFFLong" EMPTY> 1172 <!-- An integral value between 0 and 4294967295 --> 1173 <!ATTLIST "TIFFLong" "value" #CDATA #IMPLIED> 1174 <!-- The value --> 1175 <!-- Data type: String --> 1176 <!ATTLIST "TIFFLong" "description" #CDATA #IMPLIED> 1177 <!-- A description, if available --> 1178 <!-- Data type: String --> 1179 1180 <!ELEMENT "TIFFSLongs" (TIFFSLong)*> 1181 <!-- A sequence of TIFFSLong nodes --> 1182 1183 <!ELEMENT "TIFFSLong" EMPTY> 1184 <!-- An integral value between -2147483648 and 2147482647 --> 1185 <!ATTLIST "TIFFSLong" "value" #CDATA #IMPLIED> 1186 <!-- The value --> 1187 <!-- Data type: String --> 1188 <!ATTLIST "TIFFSLong" "description" #CDATA #IMPLIED> 1189 <!-- A description, if available --> 1190 <!-- Data type: String --> 1191 1192 <!ELEMENT "TIFFRationals" (TIFFRational)*> 1193 <!-- A sequence of TIFFRational nodes --> 1194 1195 <!ELEMENT "TIFFRational" EMPTY> 1196 <!-- A rational value consisting of an unsigned numerator and 1197 denominator --> 1198 <!ATTLIST "TIFFRational" "value" #CDATA #IMPLIED> 1199 <!-- The numerator and denominator, separated by a slash --> 1200 <!-- Data type: String --> 1201 1202 <!ELEMENT "TIFFSRationals" (TIFFSRational)*> 1203 <!-- A sequence of TIFFSRational nodes --> 1204 1205 <!ELEMENT "TIFFSRational" EMPTY> 1206 <!-- A rational value consisting of a signed numerator and 1207 denominator --> 1208 <!ATTLIST "TIFFSRational" "value" #CDATA #IMPLIED> 1209 <!-- The numerator and denominator, separated by a slash --> 1210 <!-- Data type: String --> 1211 1212 <!ELEMENT "TIFFFloats" (TIFFFloat)*> 1213 <!-- A sequence of TIFFFloat nodes --> 1214 1215 <!ELEMENT "TIFFFloat" EMPTY> 1216 <!-- A single-precision floating-point value --> 1217 <!ATTLIST "TIFFFloat" "value" #CDATA #IMPLIED> 1218 <!-- The value --> 1219 <!-- Data type: String --> 1220 1221 <!ELEMENT "TIFFDoubles" (TIFFDouble)*> 1222 <!-- A sequence of TIFFDouble nodes --> 1223 1224 <!ELEMENT "TIFFDouble" EMPTY> 1225 <!-- A double-precision floating-point value --> 1226 <!ATTLIST "TIFFDouble" "value" #CDATA #IMPLIED> 1227 <!-- The value --> 1228 <!-- Data type: String --> 1229 1230 <!ELEMENT "TIFFUndefined" EMPTY> 1231 <!-- Uninterpreted byte data --> 1232 <!ATTLIST "TIFFUndefined" "value" #CDATA #IMPLIED> 1233 <!-- A list of comma-separated byte values --> 1234 <!-- Data type: String --> 1235 ]> 1236 </pre> 1237 1238 @since 9 1239 </div> 1240 </main> 1241 </body> 1242 </html>