< prev index next >

src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html

Print this page


   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, 2018, 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


 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 <tr>
 239 <th>Standard Metadata Element</th>
 240 <th>Derivation from TIFF Fields</th>

 241 </tr>
 242 <tr>

 243 <td>/Chroma/ColorSpaceType@name</td>
 244 <td>PhotometricInterpretation: WhiteIsZero, BlackIsZero, TransparencyMask =
 245 "GRAY"; RGB, PaletteColor =&gt; "RGB"; CMYK =&gt; "CMYK";
 246 YCbCr =&gt; "YCbCr";
 247 CIELab, ICCLab =&gt; "Lab".</td>
 248 </tr>
 249 <tr>

 250 <td>/Chroma/NumChannels@value</td>
 251 <td>SamplesPerPixel</td>
 252 </tr>
 253 <tr>

 254 <td>/Chroma/BlackIsZero@value</td>
 255 <td>"TRUE" &lt;=&gt; PhotometricInterpretation =&gt; WhiteIsZero</td>
 256 </tr>
 257 <tr>

 258 <td>/Chroma/Palette</td>
 259 <td>ColorMap</td>
 260 </tr>
 261 <tr>

 262 <td>/Compression/CompressionTypeName@value</td>
 263 <td>Compression: Uncompressed =&gt; "none"; CCITT 1D =&gt; "CCITT
 264 RLE";
 265 Group 3 Fax =&gt; "CCITT T.4"; Group 4 Fax =&gt; "CCITT T.6";
 266 LZW =&gt; "LZW";
 267 JPEG =&gt; "Old JPEG"; New JPEG =&gt; "JPEG"; Zlib =&gt;&gt; "ZLib"; PackBits =&gt;
 268 "PackBits";
 269 Deflate =&gt; "Deflate"; Exif JPEG =&gt; "JPEG".</td>
 270 </tr>
 271 <tr>

 272 <td>/Compression/Lossless@value</td>
 273 <td>Compression: JPEG or New JPEG =&gt; "FALSE"; otherwise "TRUE".</td>
 274 </tr>
 275 <tr>

 276 <td>/Data/PlanarConfiguration@value</td>
 277 <td>Chunky =&gt; "PixelInterleaved"; Planar =&gt; "PlaneInterleaved".</td>
 278 </tr>
 279 <tr>

 280 <td>/Data/SampleFormat@value</td>
 281 <td>PhotometricInterpretation PaletteColor =&gt; "Index";
 282 SampleFormat unsigned integer data =&gt; "UnsignedIntegral";
 283 SampleFormat two's complement signed integer data =&gt; "SignedIntegral";
 284 SampleFormat IEEE floating point data =&gt; "Real";
 285 otherwise element not emitted.
 286 </td>
 287 </tr>
 288 <tr>

 289 <td>/Data/BitsPerSample@value</td>
 290 <td>BitsPerSample as a space-separated list.</td>
 291 </tr>
 292 <tr>

 293 <td>/Data/SampleMSB@value</td>
 294 <td>FillOrder: left-to-right =&gt; space-separated list of BitsPerSample-1;
 295 right-to-left =&gt; space-separated list of 0s.</td>
 296 </tr>
 297 <tr>

 298 <td>/Dimension/PixelAspectRatio@value</td>
 299 <td>(1/XResolution)/(1/YResolution)</td>
 300 </tr>
 301 <tr>

 302 <td>/Dimension/ImageOrientation@value</td>
 303 <td>Orientation</td>
 304 </tr>
 305 <tr>

 306 <td>/Dimension/HorizontalPixelSize@value</td>
 307 <td>1/XResolution in millimeters if ResolutionUnit is not None.</td>
 308 </tr>
 309 <tr>

 310 <td>/Dimension/VerticalPixelSize@value</td>
 311 <td>1/YResolution in millimeters if ResolutionUnit is not None.</td>
 312 </tr>
 313 <tr>

 314 <td>/Dimension/HorizontalPosition@value</td>
 315 <td>XPosition in millimeters if ResolutionUnit is not None.</td>
 316 </tr>
 317 <tr>

 318 <td>/Dimension/VerticalPosition@value</td>
 319 <td>YPosition in millimeters if ResolutionUnit is not None.</td>
 320 </tr>
 321 <tr>

 322 <td>/Document/FormatVersion@value</td>
 323 <td>6.0</td>
 324 </tr>
 325 <tr>

 326 <td>/Document/SubimageInterpretation@value</td>
 327 <td>NewSubFileType: transparency =&gt; "TransparencyMask";
 328 reduced-resolution =&gt; "ReducedResolution";
 329 single page =&gt; "SinglePage".</td>
 330 </tr>
 331 <tr>

 332 <td>/Document/ImageCreationTime@value</td>
 333 <td>DateTime</td>
 334 </tr>
 335 <tr>

 336 <td>/Text/TextEntry</td>
 337 <td>DocumentName, ImageDescription, Make, Model, PageName, Software,
 338 Artist, HostComputer, InkNames, Copyright:
 339 /Text/TextEntry@keyword = field name,
 340 /Text/TextEntry@value = field value.<br>
 341 Example: TIFF Software field =&gt; /Text/TextEntry@keyword = "Software",
 342 /Text/TextEntry@value = Name and version number of the software package(s)
 343 used to create the image.</td>
 344 </tr>
 345 <tr>

 346 <td>/Transparency/Alpha@value</td>
 347 <td>ExtraSamples: associated alpha =&gt; "premultiplied";
 348 unassociated alpha =&gt; "nonpremultiplied".</td>
 349 </tr>
 350 </table>
 351 
 352 <h3><a id="ExifRead">Reading Exif Images</a></h3>
 353 
 354 The TIFF reader may be used to read an uncompressed Exif image or the
 355 contents of the <code>APP1</code> marker segment of a compressed Exif image.
 356 
 357 <h4><a id="ExifReadTIFF">Reading Uncompressed Exif Images</a></h4>
 358 
 359 An uncompressed Exif image is a one- or two-page uncompressed TIFF image
 360 with a specific ordering of its IFD and image data content. Each pixel
 361 has three 8-bit samples with photometric interpretation RGB or YCbCr.
 362 The image stream must contain a single primary image and may contain a
 363 single thumbnail which if present must also be uncompressed. The usual
 364 <code>ImageReader</code> methods may be used to read the image
 365 data and metadata:


 473 JPEG-in-TIFF compression is being used, and tiles are being written
 474 each tile dimension will be rounded to the nearest multiple of 8 times
 475 the JPEG minimum coded unit (MCU) in that dimension. If JPEG-in-TIFF
 476 compression is being used and strips are being written, the number of
 477 rows per strip is rounded to a multiple of 8 times the maximum MCU over
 478 both dimensions.</p>
 479 
 480  <!-- <h3>Supported Image Types</h3> -->
 481 
 482 <!-- Table? -->
 483 
 484 <h3><a id="Compression">Compression</a></h3>
 485 
 486 The compression type may be set via the <code>setCompressionType()</code> method of
 487 the <code>ImageWriteParam</code> after setting the compression mode to
 488 <code>MODE_EXPLICIT</code>. The set of innately
 489 supported compression types is listed in the following table:
 490 
 491 <table border=1>
 492 <caption><b>Supported Compression Types</b></caption>
 493 <tr><th>Compression Type</th> <th>Description</th> <th>Reference</th></tr>
 494 <tr>
 495 <td>CCITT RLE</td>




 496 <td>Modified Huffman compression</td>
 497 <td>TIFF 6.0 Specification, Section 10</td>
 498 </tr>
 499 <tr>
 500 <td>CCITT T.4</td>
 501 <td>CCITT T.4 bilevel encoding/Group 3 facsimile compression</td>
 502 <td>TIFF 6.0 Specification, Section 11</td>
 503 </tr>
 504 <tr>
 505 <td>CCITT T.6</td>
 506 <td>CCITT T.6 bilevel encoding/Group 4 facsimile compression</td>
 507 <td>TIFF 6.0 Specification, Section 11</td></tr>
 508 <tr>
 509 <td>LZW</td>
 510 <td>LZW compression</td>
 511 <td>TIFF 6.0 Specification, Section 13</td></tr>
 512 <tr>
 513 <td>JPEG</td>
 514 <td>"New" JPEG-in-TIFF compression</td>
 515 <td>TIFF Technical Note #2</td></tr>
 516 <tr>
 517 <td>ZLib</td>
 518 <td>"Deflate/Inflate" compression (see note following this table)</td>
 519 <td>Adobe Photoshop® TIFF Technical Notes</td>
 520 </tr>
 521 <tr>
 522 <td>PackBits</td>
 523 <td>Byte-oriented, run length compression</td>
 524 <td>TIFF 6.0 Specification, Section 9</td>
 525 </tr>
 526 <tr>
 527 <td>Deflate</td>
 528 <td>"Zip-in-TIFF" compression (see note following this table)</td>
 529 <td><a href="https://tools.ietf.org/html/rfc1950">
 530 ZLIB Compressed Data Format Specification</a>,
 531 <a href="https://tools.ietf.org/html/rfc1951">
 532 DEFLATE Compressed Data Format Specification</a></td>
 533 </tr>
 534 <tr>
 535 <td>Exif JPEG</td>
 536 <td>Exif-specific JPEG compression (see note following this table)</td>
 537 <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a>
 538 (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td>
 539 </table>
 540 
 541 <p>
 542 Old-style JPEG compression as described in section 22 of the TIFF 6.0
 543 Specification is <i>not</i> supported.
 544 </p>
 545 
 546 <p> The CCITT compression types are applicable to bilevel (1-bit)
 547 images only.  The JPEG compression type is applicable to byte
 548 grayscale (1-band) and RGB (3-band) images only.</p>
 549 
 550 <p>
 551 ZLib and Deflate compression are identical except for the value of the
 552 TIFF Compression field: for ZLib the Compression field has value 8
 553 whereas for Deflate it has value 32946 (0x80b2). In both cases each
 554 image segment (strip or tile) is written as a single complete zlib data
 555 stream.


 705 by using the <code>TIFFDirectory</code> class
 706 which represents a TIFF IFD. A field in a TIFF IFD is represented by an
 707 instance of <a href="../../plugins/tiff/TIFFField.html">TIFFField</a>. For each
 708 field to be written a <code>TIFFField</code> may be added to the
 709 <code>TIFFDirectory</code> and the latter converted to an
 710 <code>IIOMetadata</code> object by invoking
 711 <code>TIFFDirectory.getAsMetadata</code>. The
 712 <code>IIOMetadata</code> object so obtained may then be passed to the TIFF
 713 writer.</p>
 714 
 715 <h4><a id="MapStandardNative"></a>
 716 Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h4>
 717 
 718 The derivation of <a href="#ImageMetadata">TIFF native image metadata</a>
 719 elements from the standard metadata format
 720 <a href="standard_metadata.html">javax_imageio_1.0</a> is
 721 given in the following table.
 722 
 723 <table border="1">
 724 <tr>
 725 <th>TIFF Field</th>
 726 <th>Derivation from Standard Metadata Elements</th>

 727 </tr>
 728 <tr>

 729 <td>
 730 PhotometricInterpretation
 731 </td>
 732 <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE"
 733 =&gt; WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value =
 734 "TransparencyMask" =&gt; TransparencyMask; "RGB" and /Chroma/Palette present =&gt;
 735 PaletteColor; "GRAY" =&gt; BlackIsZero; "RGB" =&gt; RGB; "YCbCr" =&gt; YCbCr;
 736 "CMYK" =&gt; CMYK; "Lab" =&gt; CIELab.</td>
 737 </tr>
 738 <tr>

 739 <td>SamplesPerPixel</td>
 740 <td>/Chroma/NumChannels@value</td>
 741 </tr>
 742 <tr>

 743 <td>ColorMap</td>
 744 <td>/Chroma/Palette</td>
 745 </tr>
 746 <tr>

 747 <td>Compression</td>
 748 <td>/Compression/CompressionTypeName@value: "none" =&gt; Uncompressed;
 749 "CCITT RLE" =&gt; CCITT 1D; "CCITT T.4" =&gt; Group 3 Fax; "CCITT T.6" =&gt; Group 4
 750 Fax; "LZW" =&gt; LZW; "Old JPEG" =&gt; JPEG; "JPEG" =&gt; New JPEG; "ZLib" =&gt; ZLib;
 751 "PackBits" =&gt; PackBits; "Deflate" =&gt; Deflate.</td>
 752 </tr>
 753 <tr>

 754 <td>PlanarConfiguration</td>
 755 <td>/Data/PlanarConfiguration@value: "PixelInterleaved" =&gt; Chunky;
 756 "PlaneInterleaved" =&gt; Planar.</td>
 757 </tr>
 758 <tr>

 759 <td>SampleFormat</td>
 760 <td>/Data/SampleFormat@value: "SignedIntegral" =&gt; two's complement signed
 761 integer data; "UnsignedIntegral" =&gt; unsigned integer data; "Real" =&gt;
 762 IEEE floating point data; "Index" =&gt; unsigned integer data.
 763 </td>
 764 </tr>
 765 <tr>

 766 <td>BitsPerSample</td>
 767 <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td>
 768 </tr>
 769 <tr>

 770 <td>FillOrder</td>
 771 <td>/Data/SampleMSB@value: if all values in space-separated list are 0s =&gt;
 772 right-to-left; otherwise =&gt; left-to-right.
 773 </td>
 774 </tr>
 775 <tr>

 776 <td>XResolution</td>
 777 <td>(10 / /Dimension/HorizontalPixelSize@value) or
 778 (10 / (/Dimension/VerticalPixelSize@value *
 779 /Dimension/PixelAspectRatio@value))</td>
 780 </tr>
 781 <tr>

 782 <td>YResolution</td>
 783 <td>(10 / /Dimension/VerticalPixelSize@value) or
 784 (10 / (/Dimension/HorizontalPixelSize@value /
 785 /Dimension/PixelAspectRatio@value))</td>
 786 </tr>
 787 <tr>

 788 <td>ResolutionUnit</td>
 789 <td>Centimeter if XResolution or YResolution set; otherwise None.</td>
 790 </tr>
 791 <tr>

 792 <td>Orientation</td>
 793 <td>/Dimension/ImageOrientation@value</td>
 794 </tr>
 795 <tr>

 796 <td>XPosition</td>
 797 <td>/Dimension/HorizontalPosition@value / 10</td>
 798 </tr>
 799 <tr>

 800 <td>YPosition</td>
 801 <td>/Dimension/VerticalPosition@value / 10</td>
 802 </tr>
 803 <tr>

 804 <td>NewSubFileType</td>
 805 <td>/Document/SubimageInterpretation@value: "TransparencyMask" =&gt;
 806 transparency mask; "ReducedResolution" =&gt; reduced-resolution;
 807 "SinglePage" =&gt; single page.</td>
 808 </tr>
 809 <tr>

 810 <td>DateTime</td>
 811 <td>/Document/ImageCreationTime@value</td>
 812 </tr>
 813 <tr>

 814 <td>DocumentName, ImageDescription, Make, Model, PageName, Software,
 815 Artist, HostComputer, InkNames, Copyright</td>
 816 <td>/Text/TextEntry: if /Text/TextEntry@keyword is the name of any of the
 817 TIFF Fields, e.g., "Software", then the field is added with content
 818 /Text/TextEntry@value and count 1.</td>
 819 </tr>
 820 <tr>

 821 <td>ExtraSamples</td>
 822 <td>/Transparency/Alpha@value: "premultiplied" =&gt; associated alpha, count 1;
 823 "nonpremultiplied" =&gt; unassociated alpha, count 1.</td>
 824 </tr>
 825 <tr>
 826 <td></td>
 827 <td></td>
 828 </tr>
 829 </table>
 830 
 831 <h3><a id="ExifWrite">Writing Exif Images</a></h3>
 832 
 833 The TIFF writer may be used to write an uncompressed Exif image or the
 834 contents of the <code>APP1</code> marker segment of a compressed Exif image.
 835 
 836 <h4><a id="ExifWriteTIFF">Writing Uncompressed Exif Images</a></h4>
 837 
 838 When writing a sequence of images each image is normally recorded as
 839 {IFD,&nbsp;IFD Value,&nbsp;Image Data}. The Exif specification requires
 840 that an uncompressed Exif image be structured as follows:


   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


 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 <tr>
 239 <th scope="col">Index</th>
 240 <th scope="col">Standard Metadata Element</th>
 241 <th scope="col">Derivation from TIFF Fields</th>
 242 </tr>
 243 <tr>
 244 <th scope="row">1</th>
 245 <td>/Chroma/ColorSpaceType@name</td>
 246 <td>PhotometricInterpretation: WhiteIsZero, BlackIsZero, TransparencyMask =
 247 "GRAY"; RGB, PaletteColor =&gt; "RGB"; CMYK =&gt; "CMYK";
 248 YCbCr =&gt; "YCbCr";
 249 CIELab, ICCLab =&gt; "Lab".</td>
 250 </tr>
 251 <tr>
 252 <th scope="row">2</th>
 253 <td>/Chroma/NumChannels@value</td>
 254 <td>SamplesPerPixel</td>
 255 </tr>
 256 <tr>
 257 <th scope="row">3</th>
 258 <td>/Chroma/BlackIsZero@value</td>
 259 <td>"TRUE" &lt;=&gt; PhotometricInterpretation =&gt; WhiteIsZero</td>
 260 </tr>
 261 <tr>
 262 <th scope="row">4</th>
 263 <td>/Chroma/Palette</td>
 264 <td>ColorMap</td>
 265 </tr>
 266 <tr>
 267 <th scope="row">5</th>
 268 <td>/Compression/CompressionTypeName@value</td>
 269 <td>Compression: Uncompressed =&gt; "none"; CCITT 1D =&gt; "CCITT
 270 RLE";
 271 Group 3 Fax =&gt; "CCITT T.4"; Group 4 Fax =&gt; "CCITT T.6";
 272 LZW =&gt; "LZW";
 273 JPEG =&gt; "Old JPEG"; New JPEG =&gt; "JPEG"; Zlib =&gt;&gt; "ZLib"; PackBits =&gt;
 274 "PackBits";
 275 Deflate =&gt; "Deflate"; Exif JPEG =&gt; "JPEG".</td>
 276 </tr>
 277 <tr>
 278 <th scope="row">6</th>
 279 <td>/Compression/Lossless@value</td>
 280 <td>Compression: JPEG or New JPEG =&gt; "FALSE"; otherwise "TRUE".</td>
 281 </tr>
 282 <tr>
 283 <th scope="row">7</th>
 284 <td>/Data/PlanarConfiguration@value</td>
 285 <td>Chunky =&gt; "PixelInterleaved"; Planar =&gt; "PlaneInterleaved".</td>
 286 </tr>
 287 <tr>
 288 <th scope="row">8</th>
 289 <td>/Data/SampleFormat@value</td>
 290 <td>PhotometricInterpretation PaletteColor =&gt; "Index";
 291 SampleFormat unsigned integer data =&gt; "UnsignedIntegral";
 292 SampleFormat two's complement signed integer data =&gt; "SignedIntegral";
 293 SampleFormat IEEE floating point data =&gt; "Real";
 294 otherwise element not emitted.
 295 </td>
 296 </tr>
 297 <tr>
 298 <th scope="row">9</th>
 299 <td>/Data/BitsPerSample@value</td>
 300 <td>BitsPerSample as a space-separated list.</td>
 301 </tr>
 302 <tr>
 303 <th scope="row">10</th>
 304 <td>/Data/SampleMSB@value</td>
 305 <td>FillOrder: left-to-right =&gt; space-separated list of BitsPerSample-1;
 306 right-to-left =&gt; space-separated list of 0s.</td>
 307 </tr>
 308 <tr>
 309 <th scope="row">11</th>
 310 <td>/Dimension/PixelAspectRatio@value</td>
 311 <td>(1/XResolution)/(1/YResolution)</td>
 312 </tr>
 313 <tr>
 314 <th scope="row">12</th>
 315 <td>/Dimension/ImageOrientation@value</td>
 316 <td>Orientation</td>
 317 </tr>
 318 <tr>
 319 <th scope="row">13</th>
 320 <td>/Dimension/HorizontalPixelSize@value</td>
 321 <td>1/XResolution in millimeters if ResolutionUnit is not None.</td>
 322 </tr>
 323 <tr>
 324 <th scope="row">14</th>
 325 <td>/Dimension/VerticalPixelSize@value</td>
 326 <td>1/YResolution in millimeters if ResolutionUnit is not None.</td>
 327 </tr>
 328 <tr>
 329 <th scope="row">15</th>
 330 <td>/Dimension/HorizontalPosition@value</td>
 331 <td>XPosition in millimeters if ResolutionUnit is not None.</td>
 332 </tr>
 333 <tr>
 334 <th scope="row">16</th>
 335 <td>/Dimension/VerticalPosition@value</td>
 336 <td>YPosition in millimeters if ResolutionUnit is not None.</td>
 337 </tr>
 338 <tr>
 339 <th scope="row">17</th>
 340 <td>/Document/FormatVersion@value</td>
 341 <td>6.0</td>
 342 </tr>
 343 <tr>
 344 <th scope="row">18</th>
 345 <td>/Document/SubimageInterpretation@value</td>
 346 <td>NewSubFileType: transparency =&gt; "TransparencyMask";
 347 reduced-resolution =&gt; "ReducedResolution";
 348 single page =&gt; "SinglePage".</td>
 349 </tr>
 350 <tr>
 351 <th scope="row">19</th>
 352 <td>/Document/ImageCreationTime@value</td>
 353 <td>DateTime</td>
 354 </tr>
 355 <tr>
 356 <th scope="row">20</th>
 357 <td>/Text/TextEntry</td>
 358 <td>DocumentName, ImageDescription, Make, Model, PageName, Software,
 359 Artist, HostComputer, InkNames, Copyright:
 360 /Text/TextEntry@keyword = field name,
 361 /Text/TextEntry@value = field value.<br>
 362 Example: TIFF Software field =&gt; /Text/TextEntry@keyword = "Software",
 363 /Text/TextEntry@value = Name and version number of the software package(s)
 364 used to create the image.</td>
 365 </tr>
 366 <tr>
 367 <th scope="row">21</th>
 368 <td>/Transparency/Alpha@value</td>
 369 <td>ExtraSamples: associated alpha =&gt; "premultiplied";
 370 unassociated alpha =&gt; "nonpremultiplied".</td>
 371 </tr>
 372 </table>
 373 
 374 <h3><a id="ExifRead">Reading Exif Images</a></h3>
 375 
 376 The TIFF reader may be used to read an uncompressed Exif image or the
 377 contents of the <code>APP1</code> marker segment of a compressed Exif image.
 378 
 379 <h4><a id="ExifReadTIFF">Reading Uncompressed Exif Images</a></h4>
 380 
 381 An uncompressed Exif image is a one- or two-page uncompressed TIFF image
 382 with a specific ordering of its IFD and image data content. Each pixel
 383 has three 8-bit samples with photometric interpretation RGB or YCbCr.
 384 The image stream must contain a single primary image and may contain a
 385 single thumbnail which if present must also be uncompressed. The usual
 386 <code>ImageReader</code> methods may be used to read the image
 387 data and metadata:


 495 JPEG-in-TIFF compression is being used, and tiles are being written
 496 each tile dimension will be rounded to the nearest multiple of 8 times
 497 the JPEG minimum coded unit (MCU) in that dimension. If JPEG-in-TIFF
 498 compression is being used and strips are being written, the number of
 499 rows per strip is rounded to a multiple of 8 times the maximum MCU over
 500 both dimensions.</p>
 501 
 502  <!-- <h3>Supported Image Types</h3> -->
 503 
 504 <!-- Table? -->
 505 
 506 <h3><a id="Compression">Compression</a></h3>
 507 
 508 The compression type may be set via the <code>setCompressionType()</code> method of
 509 the <code>ImageWriteParam</code> after setting the compression mode to
 510 <code>MODE_EXPLICIT</code>. The set of innately
 511 supported compression types is listed in the following table:
 512 
 513 <table border=1>
 514 <caption><b>Supported Compression Types</b></caption>

 515 <tr>
 516   <th scope="col">Compression Type</th>
 517   <th scope="col">Description</th>
 518   <th scope="col">Reference</th></tr>
 519 <tr>
 520 <th scope="row">CCITT RLE</th>
 521 <td>Modified Huffman compression</td>
 522 <td>TIFF 6.0 Specification, Section 10</td>
 523 </tr>
 524 <tr>
 525 <th scope="row">CCITT T.4</th>
 526 <td>CCITT T.4 bilevel encoding/Group 3 facsimile compression</td>
 527 <td>TIFF 6.0 Specification, Section 11</td>
 528 </tr>
 529 <tr>
 530 <th scope="row">CCITT T.6</th>
 531 <td>CCITT T.6 bilevel encoding/Group 4 facsimile compression</td>
 532 <td>TIFF 6.0 Specification, Section 11</td></tr>
 533 <tr>
 534 <th scope="row">LZW</th>
 535 <td>LZW compression</td>
 536 <td>TIFF 6.0 Specification, Section 13</td></tr>
 537 <tr>
 538 <th scope="row">JPEG</th>
 539 <td>"New" JPEG-in-TIFF compression</td>
 540 <td>TIFF Technical Note #2</td></tr>
 541 <tr>
 542 <th scope="row">ZLib</th>
 543 <td>"Deflate/Inflate" compression (see note following this table)</td>
 544 <td>Adobe Photoshop® TIFF Technical Notes</td>
 545 </tr>
 546 <tr>
 547 <th scope="row">PackBits</th>
 548 <td>Byte-oriented, run length compression</td>
 549 <td>TIFF 6.0 Specification, Section 9</td>
 550 </tr>
 551 <tr>
 552 <th scope="row">Deflate</th>
 553 <td>"Zip-in-TIFF" compression (see note following this table)</td>
 554 <td><a href="https://tools.ietf.org/html/rfc1950">
 555 ZLIB Compressed Data Format Specification</a>,
 556 <a href="https://tools.ietf.org/html/rfc1951">
 557 DEFLATE Compressed Data Format Specification</a></td>
 558 </tr>
 559 <tr>
 560 <th>Exif JPEG</th>
 561 <td>Exif-specific JPEG compression (see note following this table)</td>
 562 <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a>
 563 (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td>
 564 </table>
 565 
 566 <p>
 567 Old-style JPEG compression as described in section 22 of the TIFF 6.0
 568 Specification is <i>not</i> supported.
 569 </p>
 570 
 571 <p> The CCITT compression types are applicable to bilevel (1-bit)
 572 images only.  The JPEG compression type is applicable to byte
 573 grayscale (1-band) and RGB (3-band) images only.</p>
 574 
 575 <p>
 576 ZLib and Deflate compression are identical except for the value of the
 577 TIFF Compression field: for ZLib the Compression field has value 8
 578 whereas for Deflate it has value 32946 (0x80b2). In both cases each
 579 image segment (strip or tile) is written as a single complete zlib data
 580 stream.


 730 by using the <code>TIFFDirectory</code> class
 731 which represents a TIFF IFD. A field in a TIFF IFD is represented by an
 732 instance of <a href="../../plugins/tiff/TIFFField.html">TIFFField</a>. For each
 733 field to be written a <code>TIFFField</code> may be added to the
 734 <code>TIFFDirectory</code> and the latter converted to an
 735 <code>IIOMetadata</code> object by invoking
 736 <code>TIFFDirectory.getAsMetadata</code>. The
 737 <code>IIOMetadata</code> object so obtained may then be passed to the TIFF
 738 writer.</p>
 739 
 740 <h4><a id="MapStandardNative"></a>
 741 Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h4>
 742 
 743 The derivation of <a href="#ImageMetadata">TIFF native image metadata</a>
 744 elements from the standard metadata format
 745 <a href="standard_metadata.html">javax_imageio_1.0</a> is
 746 given in the following table.
 747 
 748 <table border="1">
 749 <tr>
 750 <th scope="col">Index</th>
 751 <th scope="col">TIFF Field</th>
 752 <th scope="col">Derivation from Standard Metadata Elements</th>
 753 </tr>
 754 <tr>
 755 <th scope="row">1</th>
 756 <td>
 757 PhotometricInterpretation
 758 </td>
 759 <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE"
 760 =&gt; WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value =
 761 "TransparencyMask" =&gt; TransparencyMask; "RGB" and /Chroma/Palette present =&gt;
 762 PaletteColor; "GRAY" =&gt; BlackIsZero; "RGB" =&gt; RGB; "YCbCr" =&gt; YCbCr;
 763 "CMYK" =&gt; CMYK; "Lab" =&gt; CIELab.</td>
 764 </tr>
 765 <tr>
 766 <th scope="row">2</th>
 767 <td>SamplesPerPixel</td>
 768 <td>/Chroma/NumChannels@value</td>
 769 </tr>
 770 <tr>
 771 <th scope="row">3</th>
 772 <td>ColorMap</td>
 773 <td>/Chroma/Palette</td>
 774 </tr>
 775 <tr>
 776 <th scope="row">4</th>
 777 <td>Compression</td>
 778 <td>/Compression/CompressionTypeName@value: "none" =&gt; Uncompressed;
 779 "CCITT RLE" =&gt; CCITT 1D; "CCITT T.4" =&gt; Group 3 Fax; "CCITT T.6" =&gt; Group 4
 780 Fax; "LZW" =&gt; LZW; "Old JPEG" =&gt; JPEG; "JPEG" =&gt; New JPEG; "ZLib" =&gt; ZLib;
 781 "PackBits" =&gt; PackBits; "Deflate" =&gt; Deflate.</td>
 782 </tr>
 783 <tr>
 784 <th scope="row">5</th>
 785 <td>PlanarConfiguration</td>
 786 <td>/Data/PlanarConfiguration@value: "PixelInterleaved" =&gt; Chunky;
 787 "PlaneInterleaved" =&gt; Planar.</td>
 788 </tr>
 789 <tr>
 790 <th scope="row">6</th>
 791 <td>SampleFormat</td>
 792 <td>/Data/SampleFormat@value: "SignedIntegral" =&gt; two's complement signed
 793 integer data; "UnsignedIntegral" =&gt; unsigned integer data; "Real" =&gt;
 794 IEEE floating point data; "Index" =&gt; unsigned integer data.
 795 </td>
 796 </tr>
 797 <tr>
 798 <th scope="row">7</th>
 799 <td>BitsPerSample</td>
 800 <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td>
 801 </tr>
 802 <tr>
 803 <th scope="row">8</th>
 804 <td>FillOrder</td>
 805 <td>/Data/SampleMSB@value: if all values in space-separated list are 0s =&gt;
 806 right-to-left; otherwise =&gt; left-to-right.
 807 </td>
 808 </tr>
 809 <tr>
 810 <th scope="row">9</th>
 811 <td>XResolution</td>
 812 <td>(10 / /Dimension/HorizontalPixelSize@value) or
 813 (10 / (/Dimension/VerticalPixelSize@value *
 814 /Dimension/PixelAspectRatio@value))</td>
 815 </tr>
 816 <tr>
 817 <th scope="row">10</th>
 818 <td>YResolution</td>
 819 <td>(10 / /Dimension/VerticalPixelSize@value) or
 820 (10 / (/Dimension/HorizontalPixelSize@value /
 821 /Dimension/PixelAspectRatio@value))</td>
 822 </tr>
 823 <tr>
 824 <th scope="row">11</th>
 825 <td>ResolutionUnit</td>
 826 <td>Centimeter if XResolution or YResolution set; otherwise None.</td>
 827 </tr>
 828 <tr>
 829 <th scope="row">12</th>
 830 <td>Orientation</td>
 831 <td>/Dimension/ImageOrientation@value</td>
 832 </tr>
 833 <tr>
 834 <th scope="row">13</th>
 835 <td>XPosition</td>
 836 <td>/Dimension/HorizontalPosition@value / 10</td>
 837 </tr>
 838 <tr>
 839 <th scope="row">14</th>
 840 <td>YPosition</td>
 841 <td>/Dimension/VerticalPosition@value / 10</td>
 842 </tr>
 843 <tr>
 844 <th scope="row">15</th>
 845 <td>NewSubFileType</td>
 846 <td>/Document/SubimageInterpretation@value: "TransparencyMask" =&gt;
 847 transparency mask; "ReducedResolution" =&gt; reduced-resolution;
 848 "SinglePage" =&gt; single page.</td>
 849 </tr>
 850 <tr>
 851 <th scope="row">16</th>
 852 <td>DateTime</td>
 853 <td>/Document/ImageCreationTime@value</td>
 854 </tr>
 855 <tr>
 856 <th scope="row">17</th>
 857 <td>DocumentName, ImageDescription, Make, Model, PageName, Software,
 858 Artist, HostComputer, InkNames, Copyright</td>
 859 <td>/Text/TextEntry: if /Text/TextEntry@keyword is the name of any of the
 860 TIFF Fields, e.g., "Software", then the field is added with content
 861 /Text/TextEntry@value and count 1.</td>
 862 </tr>
 863 <tr>
 864 <th scope="row">18</th>
 865 <td>ExtraSamples</td>
 866 <td>/Transparency/Alpha@value: "premultiplied" =&gt; associated alpha, count 1;
 867 "nonpremultiplied" =&gt; unassociated alpha, count 1.</td>
 868 </tr>
 869 <tr>
 870 <td></td>
 871 <td></td>
 872 </tr>
 873 </table>
 874 
 875 <h3><a id="ExifWrite">Writing Exif Images</a></h3>
 876 
 877 The TIFF writer may be used to write an uncompressed Exif image or the
 878 contents of the <code>APP1</code> marker segment of a compressed Exif image.
 879 
 880 <h4><a id="ExifWriteTIFF">Writing Uncompressed Exif Images</a></h4>
 881 
 882 When writing a sequence of images each image is normally recorded as
 883 {IFD,&nbsp;IFD Value,&nbsp;Image Data}. The Exif specification requires
 884 that an uncompressed Exif image be structured as follows:


< prev index next >