< prev index next >

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

Print this page
rev 55470 : 8225372: accessibility errors in tables in java.desktop files
Reviewed-by: aivanov
   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


 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 <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:
 366 
 367 <pre><code>
 368     ImageInputStream input;
 369     ImageReader tiffReader;


 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.
 556 </p>
 557 
 558 <p>


 704 <p>Setting up the image metadata to write to a TIFF stream may be simplified
 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:
 841 
 842 <a id="ExifStructure"></a>
 843 <ol>
 844 <li>Image File Header</li>
 845 <li>Primary IFD</li>
 846 <li>Primary IFD Value</li>
 847 <li>Thumbnail IFD</li>
 848 <li>Thumbnail IFD Value</li>


   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


 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 =&gt; "RGB"; CMYK =&gt; "CMYK";
 251 YCbCr =&gt; "YCbCr";
 252 CIELab, ICCLab =&gt; "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" &lt;=&gt; PhotometricInterpretation =&gt; 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 =&gt; "none"; CCITT 1D =&gt; "CCITT
 273 RLE";
 274 Group 3 Fax =&gt; "CCITT T.4"; Group 4 Fax =&gt; "CCITT T.6";
 275 LZW =&gt; "LZW";
 276 JPEG =&gt; "Old JPEG"; New JPEG =&gt; "JPEG"; Zlib =&gt;&gt; "ZLib"; PackBits =&gt;
 277 "PackBits";
 278 Deflate =&gt; "Deflate"; Exif JPEG =&gt; "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 =&gt; "FALSE"; otherwise "TRUE".</td>
 284 </tr>
 285 <tr>
 286 <th scope="row">7</th>
 287 <td>/Data/PlanarConfiguration@value</td>
 288 <td>Chunky =&gt; "PixelInterleaved"; Planar =&gt; "PlaneInterleaved".</td>
 289 </tr>
 290 <tr>
 291 <th scope="row">8</th>
 292 <td>/Data/SampleFormat@value</td>
 293 <td>PhotometricInterpretation PaletteColor =&gt; "Index";
 294 SampleFormat unsigned integer data =&gt; "UnsignedIntegral";
 295 SampleFormat two's complement signed integer data =&gt; "SignedIntegral";
 296 SampleFormat IEEE floating point data =&gt; "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 =&gt; space-separated list of BitsPerSample-1;
 309 right-to-left =&gt; 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 =&gt; "TransparencyMask";
 350 reduced-resolution =&gt; "ReducedResolution";
 351 single page =&gt; "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 =&gt; /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 =&gt; "premultiplied";
 373 unassociated alpha =&gt; "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;


 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>


 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 =&gt; WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value =
 782 "TransparencyMask" =&gt; TransparencyMask; "RGB" and /Chroma/Palette present =&gt;
 783 PaletteColor; "GRAY" =&gt; BlackIsZero; "RGB" =&gt; RGB; "YCbCr" =&gt; YCbCr;
 784 "CMYK" =&gt; CMYK; "Lab" =&gt; 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" =&gt; Uncompressed;
 800 "CCITT RLE" =&gt; CCITT 1D; "CCITT T.4" =&gt; Group 3 Fax; "CCITT T.6" =&gt; Group 4
 801 Fax; "LZW" =&gt; LZW; "Old JPEG" =&gt; JPEG; "JPEG" =&gt; New JPEG; "ZLib" =&gt; ZLib;
 802 "PackBits" =&gt; PackBits; "Deflate" =&gt; Deflate.</td>
 803 </tr>
 804 <tr>
 805 <th scope="row">5</th>
 806 <td>PlanarConfiguration</td>
 807 <td>/Data/PlanarConfiguration@value: "PixelInterleaved" =&gt; Chunky;
 808 "PlaneInterleaved" =&gt; Planar.</td>
 809 </tr>
 810 <tr>
 811 <th scope="row">6</th>
 812 <td>SampleFormat</td>
 813 <td>/Data/SampleFormat@value: "SignedIntegral" =&gt; two's complement signed
 814 integer data; "UnsignedIntegral" =&gt; unsigned integer data; "Real" =&gt;
 815 IEEE floating point data; "Index" =&gt; 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 =&gt;
 827 right-to-left; otherwise =&gt; 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" =&gt;
 868 transparency mask; "ReducedResolution" =&gt; reduced-resolution;
 869 "SinglePage" =&gt; 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" =&gt; associated alpha, count 1;
 888 "nonpremultiplied" =&gt; 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,&nbsp;IFD Value,&nbsp;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>


< prev index next >