< prev index next >

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

Print this page

        

*** 1,10 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> ! <html> <head> <!-- ! Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this --- 1,13 ---- ! <!doctype html> ! <html lang="en"> <head> + <meta charset="utf-8"/> + <title>TIFF Metadata Format Specification and Usage Notes</title> + </head> <!-- ! Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this
*** 24,120 **** Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. --> ! <title>TIFF Metadata Format Specification and Usage Notes</title> ! </head> ! <body bgcolor="white"> ! <center><h1> ! TIFF Metadata Format Specification and Usage Notes ! </h1></center> ! ! <p> ! <a href="#Reading">Reading Images</a><br/> ! <font size="-1"> <ul> <li><a href="#ColorConversionRead">Color Conversion</a></li> <li><a href="#ColorSpacesRead">Color Spaces</a></li> <li><a href="#ICCProfilesRead">ICC Profiles</a></li> <li><a href="#MetadataIssuesRead">Metadata Issues</a> - <font size="-2"> <ul> <li><a href="#MapNativeStandard">Native to Standard Metadata Mapping</a></li> </ul> - </font> </li> <li><a href="#ExifRead">Reading Exif Images</a> - <font size="-2"> <ul> <li><a href="#ExifReadTIFF">Reading Uncompressed Exif Images</a></li> <li><a href="#ExifReadJPEG">Reading Compressed Exif Images</a></li> </ul> - </font> </li> </ul> - </font> <a href="#Writing">Writing Images</a><br/> - <font size="-1"> <ul> <li><a href="#Compression">Compression</a></li> <li><a href="#ColorConversionWrite">Color Conversion</a></li> <li><a href="#ICCProfilesWrite">ICC Profiles</a></li> ! <li><a href="#MetadataIssuesWrite">Metadata Issues</a></li> ! <font size="-2"> <ul> <li><a href="#MapStandardNative">Standard to Native Metadata Mapping</a></li> </ul> - </font> <li><a href="#ExifWrite">Writing Exif Images</a> - <font size="-2"> <ul> <li><a href="#ExifWriteTIFF">Writing Uncompressed Exif Images</a></li> <li><a href="#ExifWriteJPEG">Writing Compressed Exif Images</a></li> </ul> - </font> </li> </ul> - </font> <a href="#StreamMetadata">Native Stream Metadata Format</a><br/> <a href="#ImageMetadata">Native Image Metadata Format</a> - </p> ! <h3><a name="Reading"/>Reading Images</h3> TIFF images are read by an <a href="../../ImageReader.html">ImageReader</a> which may be controlled by its public interface as well as via a supplied <a href="../../plugins/tiff/TIFFImageReadParam.html">TIFFImageReadParam</a>. <!-- <h4>Supported Image Types</h4> --> <!-- Table? --> ! <h4><a name="ColorConversionRead"/>Color Conversion</h4> <p>If the source image data have photometric type CIE L*a*b* or YCbCr, and the destination color space type is RGB, then the source image data will be automatically converted to RGB using an internal color converter.</p> ! <h4><a name="ColorSpacesRead"/>Color Spaces</h4> The raw color space assigned by default, i.e., in the absence of a user-supplied <a href="../../ImageTypeSpecifier.html">ImageTypeSpecifier</a>, will be the first among the following which applies: <ul> <li>A color space created from the <a href="#ICCProfilesRead">ICC Profile</a> metadata field if it is present and compatible with the image data layout.</li> ! <a name="nonICCProfile"><li>sRGB if the image is monochrome/bilevel (a two-level color map is created internally).</li> <li>sRGB if the image is palette-color.</li> <li>Linear RGB if the image has three samples per pixel, has photometric type CIE L*a*b*, or has photometric type YCbCr and is <i>not</i> JPEG-compressed.</li> --- 27,104 ---- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. --> ! <body> ! <h1>TIFF Metadata Format Specification and Usage Notes</h1> ! <a href="#Reading">Reading Images</a> <ul> <li><a href="#ColorConversionRead">Color Conversion</a></li> <li><a href="#ColorSpacesRead">Color Spaces</a></li> <li><a href="#ICCProfilesRead">ICC Profiles</a></li> <li><a href="#MetadataIssuesRead">Metadata Issues</a> <ul> <li><a href="#MapNativeStandard">Native to Standard Metadata Mapping</a></li> </ul> </li> <li><a href="#ExifRead">Reading Exif Images</a> <ul> <li><a href="#ExifReadTIFF">Reading Uncompressed Exif Images</a></li> <li><a href="#ExifReadJPEG">Reading Compressed Exif Images</a></li> </ul> </li> </ul> <a href="#Writing">Writing Images</a><br/> <ul> <li><a href="#Compression">Compression</a></li> <li><a href="#ColorConversionWrite">Color Conversion</a></li> <li><a href="#ICCProfilesWrite">ICC Profiles</a></li> ! <li><a href="#MetadataIssuesWrite">Metadata Issues</a> <ul> <li><a href="#MapStandardNative">Standard to Native Metadata Mapping</a></li> </ul> <li><a href="#ExifWrite">Writing Exif Images</a> <ul> <li><a href="#ExifWriteTIFF">Writing Uncompressed Exif Images</a></li> <li><a href="#ExifWriteJPEG">Writing Compressed Exif Images</a></li> </ul> </li> </ul> <a href="#StreamMetadata">Native Stream Metadata Format</a><br/> <a href="#ImageMetadata">Native Image Metadata Format</a> ! <h3><a id="Reading">Reading Images</a></h3> TIFF images are read by an <a href="../../ImageReader.html">ImageReader</a> which may be controlled by its public interface as well as via a supplied <a href="../../plugins/tiff/TIFFImageReadParam.html">TIFFImageReadParam</a>. <!-- <h4>Supported Image Types</h4> --> <!-- Table? --> ! <h4><a id="ColorConversionRead">Color Conversion</a></h4> <p>If the source image data have photometric type CIE L*a*b* or YCbCr, and the destination color space type is RGB, then the source image data will be automatically converted to RGB using an internal color converter.</p> ! <h4><a id="ColorSpacesRead">Color Spaces</a></h4> The raw color space assigned by default, i.e., in the absence of a user-supplied <a href="../../ImageTypeSpecifier.html">ImageTypeSpecifier</a>, will be the first among the following which applies: <ul> <li>A color space created from the <a href="#ICCProfilesRead">ICC Profile</a> metadata field if it is present and compatible with the image data layout.</li> ! <li><a id="nonICCProfile"></a>sRGB if the image is monochrome/bilevel (a two-level color map is created internally).</li> <li>sRGB if the image is palette-color.</li> <li>Linear RGB if the image has three samples per pixel, has photometric type CIE L*a*b*, or has photometric type YCbCr and is <i>not</i> JPEG-compressed.</li>
*** 134,144 **** <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image has more than four samples per pixel regardless of the number of bits per sample.</li> </ul> ! <p><a name="DefaultCMYK"/>The normalized color coordinate transformations used for the default CMYK color space are defined as follows: <ul> <li>CMYK to linear RGB <pre> --- 118,128 ---- <li>A fabricated, <a href="#GenericCS">generic color space</a> if the image has more than four samples per pixel regardless of the number of bits per sample.</li> </ul> ! <p><a id="DefaultCMYK"></a>The normalized color coordinate transformations used for the default CMYK color space are defined as follows: <ul> <li>CMYK to linear RGB <pre>
*** 158,179 **** C = M = Y = 0 } </pre> </li> </ul> - </p> ! <p><a name="GenericCS"/>The generic color space used when no other color space can be inferred is provided merely to enable the data to be loaded. It is not intended to provide accurate conversions of any kind.</p> <p>If the data are known to be in a color space not correctly handled by the foregoing, then an <code>ImageTypeSpecifier</code> should be supplied to the reader and should be derived from a color space which is correct for the data in question.</p> ! <h4><a name="ICCProfilesRead"/>ICC Profiles</h4> If an ICC profile is contained in the image metadata (<a href="../../plugins/tiff/BaselineTIFFTagSet.html"> BaselineTIFFTagSet</a>.TAG_ICC_PROFILE, tag number 34675), an attempt will be made to use it to create the color space --- 142,162 ---- C = M = Y = 0 } </pre> </li> </ul> ! <p><a id="GenericCS"></a>The generic color space used when no other color space can be inferred is provided merely to enable the data to be loaded. It is not intended to provide accurate conversions of any kind.</p> <p>If the data are known to be in a color space not correctly handled by the foregoing, then an <code>ImageTypeSpecifier</code> should be supplied to the reader and should be derived from a color space which is correct for the data in question.</p> ! <h4><a id="ICCProfilesRead">ICC Profiles</a></h4> If an ICC profile is contained in the image metadata (<a href="../../plugins/tiff/BaselineTIFFTagSet.html"> BaselineTIFFTagSet</a>.TAG_ICC_PROFILE, tag number 34675), an attempt will be made to use it to create the color space
*** 201,222 **** <li>Create a compatible <a href="../../ImageReadParam.html">ImageReadParam</a> and set the <code>ImageTypeSpecifier</code> using <code>ImageReadParam.setDestinationType</code>.</li> <li>Pass the parameter object to the appropriate <code>read</code> method.</li> </ol> - </p> <p>If the inferred color space not based on the ICC Profile field is compatible with the ICC profile-based color space, then a second <code>ImageTypeSpecifier</code> derived from this inferred color space will be included in the <a href="../../../../java/util/Iterator.html">Iterator</a> returned by <code>ImageReader.getImageTypes</code>. If the iterator contains more than one type, the first one will be based on the ICC profile and the second on the inferred color space.</p> ! <h4><a name="MetadataIssuesRead"/>Metadata Issues</h4> By default all recognized fields in the TIFF image file directory (IFD) are loaded into the native image metadata object. Which fields are loaded may be controlled by setting which TIFF tags the reader is allowed to recognize, whether to read fields with unrecognized tags, and whether to ignore all --- 184,204 ---- <li>Create a compatible <a href="../../ImageReadParam.html">ImageReadParam</a> and set the <code>ImageTypeSpecifier</code> using <code>ImageReadParam.setDestinationType</code>.</li> <li>Pass the parameter object to the appropriate <code>read</code> method.</li> </ol> <p>If the inferred color space not based on the ICC Profile field is compatible with the ICC profile-based color space, then a second <code>ImageTypeSpecifier</code> derived from this inferred color space will be included in the <a href="../../../../java/util/Iterator.html">Iterator</a> returned by <code>ImageReader.getImageTypes</code>. If the iterator contains more than one type, the first one will be based on the ICC profile and the second on the inferred color space.</p> ! <h4><a id="MetadataIssuesRead">Metadata Issues</a></h4> By default all recognized fields in the TIFF image file directory (IFD) are loaded into the native image metadata object. Which fields are loaded may be controlled by setting which TIFF tags the reader is allowed to recognize, whether to read fields with unrecognized tags, and whether to ignore all
*** 242,319 **** object may simplify gaining access to metadata values. An instance of <code>TIFFDirectory</code> may be created from the <code>IIOMetadata</code> object returned by the TIFF reader using the <code>TIFFDirectory.createFromMetadata</code> method.</p> ! <h5><a name="MapNativeStandard"/> Mapping of TIFF Native Image Metadata to the Standard Metadata Format</h5> The derivation of standard metadata format <a href="standard_metadata.html">javax_imageio_1.0</a> elements from <a href="#ImageMetadata">TIFF native image metadata</a> is given in the following table. - <p> <table border="1"> <tr> <th>Standard Metadata Element</th> <th>Derivation from TIFF Fields</th> </tr> <tr> <td>/Chroma/ColorSpaceType@name</td> <td>PhotometricInterpretation: WhiteIsZero, BlackIsZero, TransparencyMask = ! "GRAY"; RGB, PaletteColor => "RGB"; CMYK => "CMYK"; ! YCbCr => "YCbCr"; ! CIELab, ICCLab => "Lab".</td> </tr> <tr> <td>/Chroma/NumChannels@value</td> <td>SamplesPerPixel</td> </tr> <tr> <td>/Chroma/BlackIsZero@value</td> ! <td>"TRUE" <=> PhotometricInterpretation => WhiteIsZero</td> </tr> <tr> <td>/Chroma/Palette</td> <td>ColorMap</td> </tr> <tr> <td>/Compression/CompressionTypeName@value</td> ! <td>Compression: Uncompressed => "none"; CCITT 1D => "CCITT RLE"; ! Group 3 Fax => "CCITT T.4"; Group 4 Fax => "CCITT T.6"; ! LZW => "LZW"; ! JPEG => "Old JPEG"; New JPEG => "JPEG"; Zlib =>> "ZLib"; PackBits => "PackBits"; ! Deflate => "Deflate"; Exif JPEG => "JPEG".</td> </tr> <tr> <td>/Compression/Lossless@value</td> ! <td>Compression: JPEG or New JPEG => "FALSE"; otherwise "TRUE".</td> </tr> <tr> <td>/Data/PlanarConfiguration@value</td> ! <td>Chunky => "PixelInterleaved"; Planar => "PlaneInterleaved".</td> </tr> <tr> <td>/Data/SampleFormat@value</td> ! <td>PhotometricInterpretation PaletteColor => "Index"; ! SampleFormat unsigned integer data => "UnsignedIntegral"; ! SampleFormat two's complement signed integer data => "SignedIntegral"; ! SampleFormat IEEE floating point data => "Real"; otherwise element not emitted. </td> </tr> <tr> <td>/Data/BitsPerSample@value</td> <td>BitsPerSample as a space-separated list.</td> </tr> <tr> <td>/Data/SampleMSB@value</td> ! <td>FillOrder: left-to-right => space-separated list of BitsPerSample-1; ! right-to-left => space-separated list of 0s.</td> </tr> <tr> <td>/Dimension/PixelAspectRatio@value</td> <td>(1/XResolution)/(1/YResolution)</td> </tr> --- 224,300 ---- object may simplify gaining access to metadata values. An instance of <code>TIFFDirectory</code> may be created from the <code>IIOMetadata</code> object returned by the TIFF reader using the <code>TIFFDirectory.createFromMetadata</code> method.</p> ! <h5><a id="MapNativeStandard"></a> Mapping of TIFF Native Image Metadata to the Standard Metadata Format</h5> The derivation of standard metadata format <a href="standard_metadata.html">javax_imageio_1.0</a> elements from <a href="#ImageMetadata">TIFF native image metadata</a> is given in the following table. <table border="1"> <tr> <th>Standard Metadata Element</th> <th>Derivation from TIFF Fields</th> </tr> <tr> <td>/Chroma/ColorSpaceType@name</td> <td>PhotometricInterpretation: WhiteIsZero, BlackIsZero, TransparencyMask = ! "GRAY"; RGB, PaletteColor =&gt; "RGB"; CMYK =&gt; "CMYK"; ! YCbCr =&gt; "YCbCr"; ! CIELab, ICCLab =&gt; "Lab".</td> </tr> <tr> <td>/Chroma/NumChannels@value</td> <td>SamplesPerPixel</td> </tr> <tr> <td>/Chroma/BlackIsZero@value</td> ! <td>"TRUE" &lt;=&gt; PhotometricInterpretation =&gt; WhiteIsZero</td> </tr> <tr> <td>/Chroma/Palette</td> <td>ColorMap</td> </tr> <tr> <td>/Compression/CompressionTypeName@value</td> ! <td>Compression: Uncompressed =&gt; "none"; CCITT 1D =&gt; "CCITT RLE"; ! Group 3 Fax =&gt; "CCITT T.4"; Group 4 Fax =&gt; "CCITT T.6"; ! LZW =&gt; "LZW"; ! JPEG =&gt; "Old JPEG"; New JPEG =&gt; "JPEG"; Zlib =&gt;&gt; "ZLib"; PackBits =&gt; "PackBits"; ! Deflate =&gt; "Deflate"; Exif JPEG =&gt; "JPEG".</td> </tr> <tr> <td>/Compression/Lossless@value</td> ! <td>Compression: JPEG or New JPEG =&gt; "FALSE"; otherwise "TRUE".</td> </tr> <tr> <td>/Data/PlanarConfiguration@value</td> ! <td>Chunky =&gt; "PixelInterleaved"; Planar =&gt; "PlaneInterleaved".</td> </tr> <tr> <td>/Data/SampleFormat@value</td> ! <td>PhotometricInterpretation PaletteColor =&gt; "Index"; ! SampleFormat unsigned integer data =&gt; "UnsignedIntegral"; ! SampleFormat two's complement signed integer data =&gt; "SignedIntegral"; ! SampleFormat IEEE floating point data =&gt; "Real"; otherwise element not emitted. </td> </tr> <tr> <td>/Data/BitsPerSample@value</td> <td>BitsPerSample as a space-separated list.</td> </tr> <tr> <td>/Data/SampleMSB@value</td> ! <td>FillOrder: left-to-right =&gt; space-separated list of BitsPerSample-1; ! right-to-left =&gt; space-separated list of 0s.</td> </tr> <tr> <td>/Dimension/PixelAspectRatio@value</td> <td>(1/XResolution)/(1/YResolution)</td> </tr>
*** 341,353 **** <td>/Document/FormatVersion@value</td> <td>6.0</td> </tr> <tr> <td>/Document/SubimageInterpretation@value</td> ! <td>NewSubFileType: transparency => "TransparencyMask"; ! reduced-resolution => "ReducedResolution"; ! single page => "SinglePage".</td> </tr> <tr> <td>/Document/ImageCreationTime@value</td> <td>DateTime</td> </tr> --- 322,334 ---- <td>/Document/FormatVersion@value</td> <td>6.0</td> </tr> <tr> <td>/Document/SubimageInterpretation@value</td> ! <td>NewSubFileType: transparency =&gt; "TransparencyMask"; ! reduced-resolution =&gt; "ReducedResolution"; ! single page =&gt; "SinglePage".</td> </tr> <tr> <td>/Document/ImageCreationTime@value</td> <td>DateTime</td> </tr>
*** 355,382 **** <td>/Text/TextEntry</td> <td>DocumentName, ImageDescription, Make, Model, PageName, Software, Artist, HostComputer, InkNames, Copyright: /Text/TextEntry@keyword = field name, /Text/TextEntry@value = field value.<br> ! Example: TIFF Software field => /Text/TextEntry@keyword = "Software", /Text/TextEntry@value = Name and version number of the software package(s) used to create the image.</td> </tr> <tr> <td>/Transparency/Alpha@value</td> ! <td>ExtraSamples: associated alpha => "premultiplied"; ! unassociated alpha => "nonpremultiplied".</td> </tr> </table> - </p> ! <h4><a name="ExifRead"/>Reading Exif Images</h4> The TIFF reader may be used to read an uncompressed Exif image or the ! contents of the <tt>APP1</tt> marker segment of a compressed Exif image. ! <h5><a name="ExifReadTIFF"/>Reading Uncompressed Exif Images</h5> An uncompressed Exif image is a one- or two-page uncompressed TIFF image with a specific ordering of its IFD and image data content. Each pixel has three 8-bit samples with photometric interpretation RGB or YCbCr. The image stream must contain a single primary image and may contain a --- 336,362 ---- <td>/Text/TextEntry</td> <td>DocumentName, ImageDescription, Make, Model, PageName, Software, Artist, HostComputer, InkNames, Copyright: /Text/TextEntry@keyword = field name, /Text/TextEntry@value = field value.<br> ! Example: TIFF Software field =&gt; /Text/TextEntry@keyword = "Software", /Text/TextEntry@value = Name and version number of the software package(s) used to create the image.</td> </tr> <tr> <td>/Transparency/Alpha@value</td> ! <td>ExtraSamples: associated alpha =&gt; "premultiplied"; ! unassociated alpha =&gt; "nonpremultiplied".</td> </tr> </table> ! <h4><a id="ExifRead">Reading Exif Images</a></h4> The TIFF reader may be used to read an uncompressed Exif image or the ! contents of the <code>APP1</code> marker segment of a compressed Exif image. ! <h5><a id="ExifReadTIFF">Reading Uncompressed Exif Images</a></h5> An uncompressed Exif image is a one- or two-page uncompressed TIFF image with a specific ordering of its IFD and image data content. Each pixel has three 8-bit samples with photometric interpretation RGB or YCbCr. The image stream must contain a single primary image and may contain a
*** 404,432 **** Note that the Exif thumbnail is treated as a separate page in the TIFF stream and not as a thumbnail, i.e., <code>tiffReader.hasThumbnails(0)</code> will return <code>false</code>. ! <h5><a name="ExifReadJPEG"/>Reading Compressed Exif Images</h5> A compressed Exif image is a 3-band ISO/IEC 10918-1 baseline DCT JPEG stream ! with an inserted <tt>APP1</tt> marker segment. The parameters of the marker segment after the length are the 6-byte sequence ! <code>{'E',&nbsp;'x',&nbsp;'i',&nbsp;'f',&nbsp;0x00,&nbsp;0x00}</code></code> followed by a complete TIFF stream. The embedded TIFF stream contains a primary IFD describing the JPEG image optionally followed by a thumbnail IFD and compressed or uncompressed thumbnail image data. Note that the embedded TIFF stream does not contain any image data associated with the primary IFD nor any descriptive fields which duplicate information found in the JPEG stream itself. ! <p>The parameter content of the <tt>APP1</tt> marker segment may be obtained from the user object of the associated <code>Node</code> in a ! <tt>javax_imageio_jpeg_image_1.0</tt> native image metadata tree extracted from the image metadata object returned by the JPEG reader. This APP1 Exif node will be a child of the node named "markerSequence" and will ! have name <tt>unknown</tt> and an attribute named <tt>MarkerTag</tt> with integral value <code>0xE1</code> (<code>String</code> value <code>"225"</code>). The user object of this node will be a byte array which starts with the six bytes <code>{'E', 'x', 'i', 'f', '0', '0'}</code>. The primary IFD and the thumbnail IFD and image may be read from the user object by the usual <code>ImageReader</code> --- 384,412 ---- Note that the Exif thumbnail is treated as a separate page in the TIFF stream and not as a thumbnail, i.e., <code>tiffReader.hasThumbnails(0)</code> will return <code>false</code>. ! <h5><a id="ExifReadJPEG">Reading Compressed Exif Images</a></h5> A compressed Exif image is a 3-band ISO/IEC 10918-1 baseline DCT JPEG stream ! with an inserted <code>APP1</code> marker segment. The parameters of the marker segment after the length are the 6-byte sequence ! <code>{'E',&nbsp;'x',&nbsp;'i',&nbsp;'f',&nbsp;0x00,&nbsp;0x00}</code> followed by a complete TIFF stream. The embedded TIFF stream contains a primary IFD describing the JPEG image optionally followed by a thumbnail IFD and compressed or uncompressed thumbnail image data. Note that the embedded TIFF stream does not contain any image data associated with the primary IFD nor any descriptive fields which duplicate information found in the JPEG stream itself. ! <p>The parameter content of the <code>APP1</code> marker segment may be obtained from the user object of the associated <code>Node</code> in a ! <code>javax_imageio_jpeg_image_1.0</code> native image metadata tree extracted from the image metadata object returned by the JPEG reader. This APP1 Exif node will be a child of the node named "markerSequence" and will ! have name <code>unknown</code> and an attribute named <code>MarkerTag</code> with integral value <code>0xE1</code> (<code>String</code> value <code>"225"</code>). The user object of this node will be a byte array which starts with the six bytes <code>{'E', 'x', 'i', 'f', '0', '0'}</code>. The primary IFD and the thumbnail IFD and image may be read from the user object by the usual <code>ImageReader</code>
*** 470,490 **** Note that <code>tiffReader.getNumImages(true)</code> returns the number of IFDs in the embedded TIFF stream including those corresponding to empty images. Calling <code>tiffReader.read(0,&nbsp;readParam)</code> will throw an exception as the primary image in the embedded TIFF stream is always empty; the primary image should be obtained using the JPEG reader itself. - </p> ! <h3><a name="Writing"/>Writing Images</h3> TIFF images are written by a <a href="../../ImageWriter.html">ImageWriter</a> which may be controlled by its public interface as well as via a supplied <a href="../../ImageWriteParam.html">ImageWriteParam</a>. For an <code>ImageWriteParam</code> returned by the <code>getDefaultWriteParam()</code> method of the TIFF <code>ImageWriter</code>, the <code>canWriteTiles()</code> and <code>canWriteCompressed()</code> methods will return <code>true</code>; the <code>canOffsetTiles()</code> and ! <code>canWriteProgressive()</code> methods will return <code>false</code>.</p> The TIFF writer supports many optional capabilities including writing tiled images, inserting images, writing or inserting empty images, and replacing image data. Pixels may be replaced in either empty or non-empty images but if and only if the data are not compressed. --- 450,469 ---- Note that <code>tiffReader.getNumImages(true)</code> returns the number of IFDs in the embedded TIFF stream including those corresponding to empty images. Calling <code>tiffReader.read(0,&nbsp;readParam)</code> will throw an exception as the primary image in the embedded TIFF stream is always empty; the primary image should be obtained using the JPEG reader itself. ! <h3><a id="Writing">Writing Images</a></h3> TIFF images are written by a <a href="../../ImageWriter.html">ImageWriter</a> which may be controlled by its public interface as well as via a supplied <a href="../../ImageWriteParam.html">ImageWriteParam</a>. For an <code>ImageWriteParam</code> returned by the <code>getDefaultWriteParam()</code> method of the TIFF <code>ImageWriter</code>, the <code>canWriteTiles()</code> and <code>canWriteCompressed()</code> methods will return <code>true</code>; the <code>canOffsetTiles()</code> and ! <code>canWriteProgressive()</code> methods will return <code>false</code>. The TIFF writer supports many optional capabilities including writing tiled images, inserting images, writing or inserting empty images, and replacing image data. Pixels may be replaced in either empty or non-empty images but if and only if the data are not compressed.
*** 500,510 **** <!-- <h4>Supported Image Types</h4> --> <!-- Table? --> ! <h4><a name="Compression"/>Compression</h4> The compression type may be set via the <code>setCompressionType()</code> method of the <code>ImageWriteParam</code> after setting the compression mode to <code>MODE_EXPLICIT</code>. The set of innately supported compression types is listed in the following table: --- 479,489 ---- <!-- <h4>Supported Image Types</h4> --> <!-- Table? --> ! <h4><a id="Compression">Compression</a></h4> The compression type may be set via the <code>setCompressionType()</code> method of the <code>ImageWriteParam</code> after setting the compression mode to <code>MODE_EXPLICIT</code>. The set of innately supported compression types is listed in the following table:
*** 592,725 **** replacement capability of the TIFF writer. </p> <p> If ZLib/Deflate or JPEG compression is used, the compression quality may be set. For ZLib/Deflate the supplied floating point quality value is ! rescaled to the range <tt>[1,&nbsp;9]</tt> and truncated to an integer to derive the Deflate compression level. For JPEG the floating point quality value is passed directly to the JPEG writer plug-in which interprets it in the usual way.</p> ! <h4><a name="ColorConversionWrite"/>Color Conversion</h4> <p>If the source image data color space type is RGB, and the destination photometric type is CIE L*a*b* or YCbCr, then the source image data will be automatically converted from RGB using an internal color converter.</p> ! <h4><a name="ICCProfilesWrite"/>ICC Profiles</h4> ! An <tt>ICC Profile</tt> field will be written if either: <ul> <li>one is present in the native image metadata <a href="../IIOMetadata.html">IIOMetadata</a> instance supplied to the writer, or</li> <li>the <a href="../../../../java/awt/color/ColorSpace.html">ColorSpace</a> of the destination <code>ImageTypeSpecifier</code> is an instance of <code>ICC_ColorSpace</code> which is not one of the standard ! color spaces defined by the <tt>CS_*</tt> constants in the <code>ColorSpace</code> class. The destination type is set via <code>ImageWriteParam.setDestinationType(ImageTypeSpecifier)</code> and defaults to the <code>ImageTypeSpecifier</code> of the image being written. </li> </ul> ! <h4><a name="MetadataIssuesWrite"/>Metadata Issues</h4> Some behavior of the writer is affected by or may affect the contents of the image metadata which may be supplied by the user. ! <p>For bilevel images, the <tt>FillOrder</tt>, and <tt>T4Options</tt> fields affect the output data. The data will be filled right-to-left if ! <tt>FillOrder</tt> is present with a value of 2 (<code>BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT</code>) ! and will be filled left-to-right otherwise. The value of <tt>T4Options</tt> specifies whether the data should be 1D- or 2D-encoded and whether EOL padding should be used.</p> ! <p>For all images the value of the <tt>RowsPerStrip</tt> field is used to the set the number of rows per strip if the image is not tiled. The default number of rows per strip is either 8 or the number of rows which would fill no more than 8 kilobytes, whichever is larger.</p> ! <p>For all images the tile dimensions may be set using the <tt>TileWidth</tt> ! and <tt>TileLength</tt> field values if the tiling mode is <code>ImageWriteParam.MODE_COPY_FROM_METADATA</code>. If this mode is set but the fields are not, their respective default values are the image width and height.</p> ! <p>When using JPEG-in-TIFF compression, a <tt>JPEGTables</tt> field will be written to the IFD and abbreviated JPEG streams to each strip or tile if and ! only if a <tt>JPEGTables</tt> field is contained in the metadata object ! provided to the writer. If the contents of the <tt>JPEGTables</tt> field is a valid tables-only JPEG stream, then it will be used; otherwise the contents of the field will be replaced with default visually lossless tables. If no ! such <tt>JPEGTables</tt> field is present in the metadata, then no ! <tt>JPEGTables</tt> field will be written to the output and each strip or tile will be written as a separate, self-contained JPEG stream.</p> <p>When using Deflate/ZLib or LZW compression, if the image has 8 bits per sample, a horizontal differencing predictor will be used if the ! <tt>Predictor</tt> field is present with a value of 2 (<code>BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING</code>). If prediction is so requested but the image does not have 8 bits per sample the field will be reset to have the value 1 (<code>BaselineTIFFTagSet.PREDICTOR_NONE</code>). </p> <p>Some fields may be added or modified: <ul> ! <li><tt>PhotometricInterpretation</tt> if not present.</li> ! <li><tt>PlanarConfiguration</tt> if this field is present with value ! <tt>Planar</tt> is is reset to <tt>Chunky</tt>.</li> ! <li><tt>Compression</tt> always.</li> ! <li><tt>BitsPerSample</tt> if the image is not bilevel.</li> ! <li><tt>SamplesPerPixel</tt> always.</li> ! <li><tt>ExtraSamples</tt> if an alpha channel is present.</li> ! <li><tt>SampleFormat</tt> if not present and the data are 16- or 32-bit integers or floating point.</li> ! <li><tt>ColorMap</tt> if the <tt>PhotometricInterpretation</tt> is ! <tt>RGBPalette</tt>.</li> ! <li><tt>ImageWidth</tt> and <tt>ImageLength</tt> always.</li> ! <li><tt>TileWidth</tt>, <tt>TileLength</tt>, <tt>TileOffsets</tt>, and ! <tt>TileByteCounts</tt> if a tiled image is being written.</li> ! <li><tt>RowsPerStrip</tt>, <tt>StripOffsets</tt>, and <tt>StripByteCounts</tt> if a tiled image is <i>not</i> being written.</li> ! <li><tt>XResolution</tt>, <tt>YResolution</tt>, and <tt>ResolutionUnit</tt> if none of these is present.</li> ! <li><tt>YCbCrSubsampling</tt> and <tt>YCbCrPositioning</tt> if the photometric interpretation is YCbCr and the compression type is not JPEG (only [1,&nbsp;1] subsampling and cosited positioning are supported for non-JPEG YCbCr output).</li> ! <li><tt>YCbCrSubsampling</tt>, <tt>YCbCrPositioning</tt>, and ! <tt>ReferenceBlackWhite</tt>: if the compression type is JPEG and the color space is RGB these will be reset to [2,&nbsp;2] centered subsampling with no headroom/footroom (0:255,128:255,128:255).</li> </ul> <p>Some fields may be removed: <ul> ! <li><tt>BitsPerSample</tt> if the image is bilevel.</li> ! <li><tt>ExtraSamples</tt> if the image does not have an alpha channel.</li> ! <li><tt>ColorMap</tt> if the photometric interpretation is not ! <tt>RGBPalette</tt>.</li> ! <li><tt>TileWidth</tt>, <tt>TileLength</tt>, <tt>TileOffsets</tt>, and ! <tt>TileByteCounts</tt> if tiling <i>is not</i> being used.</li> ! <li><tt>RowsPerStrip</tt>, <tt>StripOffsets</tt>, and <tt>StripByteCounts</tt> if tiling <i>is</i> being used.</li> ! <li><tt>YCbCrSubsampling</tt>, <tt>YCbCrPositioning</tt>, and ! <tt>ReferenceBlackWhite</tt> if the compression type is JPEG and the color space is grayscale.</li> ! <li><tt>JPEGProc</tt>, <tt>JPEGInterchangeFormat</tt>, ! <tt>JPEGInterchangeFormatLength</tt>, <tt>JPEGRestartInterval</tt>, ! <tt>JPEGLosslessPredictors</tt>, <tt>JPEGPointTransforms</tt>, ! <tt>JPEGQTables</tt>, <tt>JPEGDCTables</tt>, and ! <tt>JPEGACTables</tt> if the compression type is JPEG.</li> </ul> - </p> <p>Other fields present in the supplied metadata are uninterpreted and will be written as supplied.</p> <p>If an Exif image is being written, the set of fields present and their --- 571,703 ---- replacement capability of the TIFF writer. </p> <p> If ZLib/Deflate or JPEG compression is used, the compression quality may be set. For ZLib/Deflate the supplied floating point quality value is ! rescaled to the range <code>[1,&nbsp;9]</code> and truncated to an integer to derive the Deflate compression level. For JPEG the floating point quality value is passed directly to the JPEG writer plug-in which interprets it in the usual way.</p> ! <h4><a id="ColorConversionWrite">Color Conversion</a></h4> <p>If the source image data color space type is RGB, and the destination photometric type is CIE L*a*b* or YCbCr, then the source image data will be automatically converted from RGB using an internal color converter.</p> ! <h4><a id="ICCProfilesWrite">ICC Profiles</a></h4> ! An <code>ICC Profile</code> field will be written if either: <ul> <li>one is present in the native image metadata <a href="../IIOMetadata.html">IIOMetadata</a> instance supplied to the writer, or</li> <li>the <a href="../../../../java/awt/color/ColorSpace.html">ColorSpace</a> of the destination <code>ImageTypeSpecifier</code> is an instance of <code>ICC_ColorSpace</code> which is not one of the standard ! color spaces defined by the <code>CS_*</code> constants in the <code>ColorSpace</code> class. The destination type is set via <code>ImageWriteParam.setDestinationType(ImageTypeSpecifier)</code> and defaults to the <code>ImageTypeSpecifier</code> of the image being written. </li> </ul> ! <h4><a id="MetadataIssuesWrite">Metadata Issues</a></h4> Some behavior of the writer is affected by or may affect the contents of the image metadata which may be supplied by the user. ! <p>For bilevel images, the <code>FillOrder</code>, and <code>T4Options</code> fields affect the output data. The data will be filled right-to-left if ! <code>FillOrder</code> is present with a value of 2 (<code>BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT</code>) ! and will be filled left-to-right otherwise. The value of <code>T4Options</code> specifies whether the data should be 1D- or 2D-encoded and whether EOL padding should be used.</p> ! <p>For all images the value of the <code>RowsPerStrip</code> field is used to the set the number of rows per strip if the image is not tiled. The default number of rows per strip is either 8 or the number of rows which would fill no more than 8 kilobytes, whichever is larger.</p> ! <p>For all images the tile dimensions may be set using the <code>TileWidth</code> ! and <code>TileLength</code> field values if the tiling mode is <code>ImageWriteParam.MODE_COPY_FROM_METADATA</code>. If this mode is set but the fields are not, their respective default values are the image width and height.</p> ! <p>When using JPEG-in-TIFF compression, a <code>JPEGTables</code> field will be written to the IFD and abbreviated JPEG streams to each strip or tile if and ! only if a <code>JPEGTables</code> field is contained in the metadata object ! provided to the writer. If the contents of the <code>JPEGTables</code> field is a valid tables-only JPEG stream, then it will be used; otherwise the contents of the field will be replaced with default visually lossless tables. If no ! such <code>JPEGTables</code> field is present in the metadata, then no ! <code>JPEGTables</code> field will be written to the output and each strip or tile will be written as a separate, self-contained JPEG stream.</p> <p>When using Deflate/ZLib or LZW compression, if the image has 8 bits per sample, a horizontal differencing predictor will be used if the ! <code>Predictor</code> field is present with a value of 2 (<code>BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING</code>). If prediction is so requested but the image does not have 8 bits per sample the field will be reset to have the value 1 (<code>BaselineTIFFTagSet.PREDICTOR_NONE</code>). </p> <p>Some fields may be added or modified: <ul> ! <li><code>PhotometricInterpretation</code> if not present.</li> ! <li><code>PlanarConfiguration</code> if this field is present with value ! <code>Planar</code> is is reset to <code>Chunky</code>.</li> ! <li><code>Compression</code> always.</li> ! <li><code>BitsPerSample</code> if the image is not bilevel.</li> ! <li><code>SamplesPerPixel</code> always.</li> ! <li><code>ExtraSamples</code> if an alpha channel is present.</li> ! <li><code>SampleFormat</code> if not present and the data are 16- or 32-bit integers or floating point.</li> ! <li><code>ColorMap</code> if the <code>PhotometricInterpretation</code> is ! <code>RGBPalette</code>.</li> ! <li><code>ImageWidth</code> and <code>ImageLength</code> always.</li> ! <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and ! <code>TileByteCounts</code> if a tiled image is being written.</li> ! <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> if a tiled image is <i>not</i> being written.</li> ! <li><code>XResolution</code>, <code>YResolution</code>, and <code>ResolutionUnit</code> if none of these is present.</li> ! <li><code>YCbCrSubsampling</code> and <code>YCbCrPositioning</code> if the photometric interpretation is YCbCr and the compression type is not JPEG (only [1,&nbsp;1] subsampling and cosited positioning are supported for non-JPEG YCbCr output).</li> ! <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and ! <code>ReferenceBlackWhite</code>: if the compression type is JPEG and the color space is RGB these will be reset to [2,&nbsp;2] centered subsampling with no headroom/footroom (0:255,128:255,128:255).</li> </ul> <p>Some fields may be removed: <ul> ! <li><code>BitsPerSample</code> if the image is bilevel.</li> ! <li><code>ExtraSamples</code> if the image does not have an alpha channel.</li> ! <li><code>ColorMap</code> if the photometric interpretation is not ! <code>RGBPalette</code>.</li> ! <li><code>TileWidth</code>, <code>TileLength</code>, <code>TileOffsets</code>, and ! <code>TileByteCounts</code> if tiling <i>is not</i> being used.</li> ! <li><code>RowsPerStrip</code>, <code>StripOffsets</code>, and <code>StripByteCounts</code> if tiling <i>is</i> being used.</li> ! <li><code>YCbCrSubsampling</code>, <code>YCbCrPositioning</code>, and ! <code>ReferenceBlackWhite</code> if the compression type is JPEG and the color space is grayscale.</li> ! <li><code>JPEGProc</code>, <code>JPEGInterchangeFormat</code>, ! <code>JPEGInterchangeFormatLength</code>, <code>JPEGRestartInterval</code>, ! <code>JPEGLosslessPredictors</code>, <code>JPEGPointTransforms</code>, ! <code>JPEGQTables</code>, <code>JPEGDCTables</code>, and ! <code>JPEGACTables</code> if the compression type is JPEG.</li> </ul> <p>Other fields present in the supplied metadata are uninterpreted and will be written as supplied.</p> <p>If an Exif image is being written, the set of fields present and their
*** 735,767 **** <code>IIOMetadata</code> object by invoking <code>TIFFDirectory.getAsMetadata</code>. The <code>IIOMetadata</code> object so obtained may then be passed to the TIFF writer.</p> ! <h5><a name="MapStandardNative"/> Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h5> The derivation of <a href="#ImageMetadata">TIFF native image metadata</a> elements from the standard metadata format <a href="standard_metadata.html">javax_imageio_1.0</a> is given in the following table. - <p> <table border="1"> <tr> <th>TIFF Field</th> <th>Derivation from Standard Metadata Elements</th> </tr> <tr> <td> PhotometricInterpretation </td> <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE" ! => WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value = ! "TransparencyMask" => TransparencyMask; "RGB" and /Chroma/Palette present => ! PaletteColor; "GRAY" => BlackIsZero; "RGB" => RGB; "YCbCr" => YCbCr; ! "CMYK" => CMYK; "Lab" => CIELab.</td> </tr> <tr> <td>SamplesPerPixel</td> <td>/Chroma/NumChannels@value</td> </tr> --- 713,744 ---- <code>IIOMetadata</code> object by invoking <code>TIFFDirectory.getAsMetadata</code>. The <code>IIOMetadata</code> object so obtained may then be passed to the TIFF writer.</p> ! <h5><a id="MapStandardNative"></a> Mapping of the Standard Metadata Format to TIFF Native Image Metadata</h5> The derivation of <a href="#ImageMetadata">TIFF native image metadata</a> elements from the standard metadata format <a href="standard_metadata.html">javax_imageio_1.0</a> is given in the following table. <table border="1"> <tr> <th>TIFF Field</th> <th>Derivation from Standard Metadata Elements</th> </tr> <tr> <td> PhotometricInterpretation </td> <td>/Chroma/ColorSpaceType@name: "GRAY" and /Chroma/BlackIsZero@value = "FALSE" ! =&gt; WhiteIsZero; "GRAY" and /Document/SubimageInterpretation@value = ! "TransparencyMask" =&gt; TransparencyMask; "RGB" and /Chroma/Palette present =&gt; ! PaletteColor; "GRAY" =&gt; BlackIsZero; "RGB" =&gt; RGB; "YCbCr" =&gt; YCbCr; ! "CMYK" =&gt; CMYK; "Lab" =&gt; CIELab.</td> </tr> <tr> <td>SamplesPerPixel</td> <td>/Chroma/NumChannels@value</td> </tr>
*** 769,803 **** <td>ColorMap</td> <td>/Chroma/Palette</td> </tr> <tr> <td>Compression</td> ! <td>/Compression/CompressionTypeName@value: "none" => Uncompressed; ! "CCITT RLE" => CCITT 1D; "CCITT T.4" => Group 3 Fax; "CCITT T.6" => Group 4 ! Fax; "LZW" => LZW; "Old JPEG" => JPEG; "JPEG" => New JPEG; "ZLib" => ZLib; ! "PackBits" => PackBits; "Deflate" => Deflate.</td> </tr> <tr> <td>PlanarConfiguration</td> ! <td>/Data/PlanarConfiguration@value: "PixelInterleaved" => Chunky; ! "PlaneInterleaved" => Planar.</td> </tr> <tr> <td>SampleFormat</td> ! <td>/Data/SampleFormat@value: "SignedIntegral" => two's complement signed ! integer data; "UnsignedIntegral" => unsigned integer data; "Real" => ! IEEE floating point data; "Index" => unsigned integer data. </td> </tr> <tr> <td>BitsPerSample</td> <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td> </tr> <tr> <td>FillOrder</td> ! <td>/Data/SampleMSB@value: if all values in space-separated list are 0s => ! right-to-left; otherwise => left-to-right. </td> </tr> <tr> <td>XResolution</td> <td>(10 / /Dimension/HorizontalPixelSize@value) or --- 746,780 ---- <td>ColorMap</td> <td>/Chroma/Palette</td> </tr> <tr> <td>Compression</td> ! <td>/Compression/CompressionTypeName@value: "none" =&gt; Uncompressed; ! "CCITT RLE" =&gt; CCITT 1D; "CCITT T.4" =&gt; Group 3 Fax; "CCITT T.6" =&gt; Group 4 ! Fax; "LZW" =&gt; LZW; "Old JPEG" =&gt; JPEG; "JPEG" =&gt; New JPEG; "ZLib" =&gt; ZLib; ! "PackBits" =&gt; PackBits; "Deflate" =&gt; Deflate.</td> </tr> <tr> <td>PlanarConfiguration</td> ! <td>/Data/PlanarConfiguration@value: "PixelInterleaved" =&gt; Chunky; ! "PlaneInterleaved" =&gt; Planar.</td> </tr> <tr> <td>SampleFormat</td> ! <td>/Data/SampleFormat@value: "SignedIntegral" =&gt; two's complement signed ! integer data; "UnsignedIntegral" =&gt; unsigned integer data; "Real" =&gt; ! IEEE floating point data; "Index" =&gt; unsigned integer data. </td> </tr> <tr> <td>BitsPerSample</td> <td>/Data/BitsPerSample@value: space-separated list parsed to char array.</td> </tr> <tr> <td>FillOrder</td> ! <td>/Data/SampleMSB@value: if all values in space-separated list are 0s =&gt; ! right-to-left; otherwise =&gt; left-to-right. </td> </tr> <tr> <td>XResolution</td> <td>(10 / /Dimension/HorizontalPixelSize@value) or
*** 826,838 **** <td>YPosition</td> <td>/Dimension/VerticalPosition@value / 10</td> </tr> <tr> <td>NewSubFileType</td> ! <td>/Document/SubimageInterpretation@value: "TransparencyMask" => ! transparency mask; "ReducedResolution" => reduced-resolution; ! "SinglePage" => single page.</td> </tr> <tr> <td>DateTime</td> <td>/Document/ImageCreationTime@value</td> </tr> --- 803,815 ---- <td>YPosition</td> <td>/Dimension/VerticalPosition@value / 10</td> </tr> <tr> <td>NewSubFileType</td> ! <td>/Document/SubimageInterpretation@value: "TransparencyMask" =&gt; ! transparency mask; "ReducedResolution" =&gt; reduced-resolution; ! "SinglePage" =&gt; single page.</td> </tr> <tr> <td>DateTime</td> <td>/Document/ImageCreationTime@value</td> </tr>
*** 843,875 **** TIFF Fields, e.g., "Software", then the field is added with content /Text/TextEntry@value and count 1.</td> </tr> <tr> <td>ExtraSamples</td> ! <td>/Transparency/Alpha@value: "premultiplied" => associated alpha, count 1; ! "nonpremultiplied" => unassociated alpha, count 1.</td> </tr> <tr> <td></td> <td></td> </tr> </table> - </p> ! <h4><a name="ExifWrite"/>Writing Exif Images</h4> The TIFF writer may be used to write an uncompressed Exif image or the ! contents of the <tt>APP1</tt> marker segment of a compressed Exif image. ! <h5><a name="ExifWriteTIFF"/>Writing Uncompressed Exif Images</h5> When writing a sequence of images each image is normally recorded as {IFD,&nbsp;IFD Value,&nbsp;Image Data}. The Exif specification requires that an uncompressed Exif image be structured as follows: <ol> - <a name="ExifStructure"/> <li>Image File Header</li> <li>Primary IFD</li> <li>Primary IFD Value</li> <li>Thumbnail IFD</li> <li>Thumbnail IFD Value</li> --- 820,851 ---- TIFF Fields, e.g., "Software", then the field is added with content /Text/TextEntry@value and count 1.</td> </tr> <tr> <td>ExtraSamples</td> ! <td>/Transparency/Alpha@value: "premultiplied" =&gt; associated alpha, count 1; ! "nonpremultiplied" =&gt; unassociated alpha, count 1.</td> </tr> <tr> <td></td> <td></td> </tr> </table> ! <h4><a id="ExifWrite">Writing Exif Images</a></h4> The TIFF writer may be used to write an uncompressed Exif image or the ! contents of the <code>APP1</code> marker segment of a compressed Exif image. ! <h5><a id="ExifWriteTIFF">Writing Uncompressed Exif Images</a></h5> When writing a sequence of images each image is normally recorded as {IFD,&nbsp;IFD Value,&nbsp;Image Data}. The Exif specification requires that an uncompressed Exif image be structured as follows: + <a id="ExifStructure"></a> <ol> <li>Image File Header</li> <li>Primary IFD</li> <li>Primary IFD Value</li> <li>Thumbnail IFD</li> <li>Thumbnail IFD Value</li>
*** 925,937 **** new IIOImage(image, null, primaryIFD), tiffWriteParam); } </code></pre> ! <h5><a name="ExifWriteJPEG"/>Writing Compressed Exif Images</h5> ! The structure of the embedded TIFF stream in the <tt>APP1</tt> segment of a compressed Exif image is identical to the <a href="#ExifStructure"> uncompressed Exif image structure</a> except that there are no primary image data, i.e., the primary IFD does not refer to any image data. <pre><code> --- 901,913 ---- new IIOImage(image, null, primaryIFD), tiffWriteParam); } </code></pre> ! <h5><a id="ExifWriteJPEG">Writing Compressed Exif Images</a></h5> ! The structure of the embedded TIFF stream in the <code>APP1</code> segment of a compressed Exif image is identical to the <a href="#ExifStructure"> uncompressed Exif image structure</a> except that there are no primary image data, i.e., the primary IFD does not refer to any image data. <pre><code>
*** 1013,1023 **** jpegWriteParam); String nativeFormat = jpegImageMetadata.getNativeMetadataFormatName(); Node tree = jpegImageMetadata.getAsTree(nativeFormat); NodeList children = tree.getChildNodes(); int numChildren = children.getLength(); ! for (int i = 0; i < numChildren; i++) { Node child = children.item(i); if (child.getNodeName().equals("markerSequence")) { child.appendChild(app1Node); break; } --- 989,999 ---- jpegWriteParam); String nativeFormat = jpegImageMetadata.getNativeMetadataFormatName(); Node tree = jpegImageMetadata.getAsTree(nativeFormat); NodeList children = tree.getChildNodes(); int numChildren = children.getLength(); ! for (int i = 0; i &lt; numChildren; i++) { Node child = children.item(i); if (child.getNodeName().equals("markerSequence")) { child.appendChild(app1Node); break; }
*** 1032,1042 **** The <code>"unknown"</code> node created above would be appended to the <code>"markerSequence"</code> node of the native JPEG image metadata and written to the JPEG stream when the primary image is written using the JPEG writer. ! <h3><a name="StreamMetadata"/>Stream Metadata</h3> The DTD for the TIFF native stream metadata format is as follows: <pre> &lt;!DOCTYPE "javax_imageio_tiff_stream_1.0" [ --- 1008,1018 ---- The <code>"unknown"</code> node created above would be appended to the <code>"markerSequence"</code> node of the native JPEG image metadata and written to the JPEG stream when the primary image is written using the JPEG writer. ! <h3><a id="StreamMetadata">Stream Metadata</a></h3> The DTD for the TIFF native stream metadata format is as follows: <pre> &lt;!DOCTYPE "javax_imageio_tiff_stream_1.0" [
*** 1049,1059 **** &lt;!-- One of "BIG_ENDIAN" or "LITTLE_ENDIAN" --&gt; &lt;!-- Data type: String --&gt; ]&gt; </pre> ! <h3><a name="ImageMetadata"/>Image Metadata</h3> The DTD for the TIFF native image metadata format is as follows: <pre> &lt;!DOCTYPE "javax_imageio_tiff_image_1.0" [ --- 1025,1035 ---- &lt;!-- One of "BIG_ENDIAN" or "LITTLE_ENDIAN" --&gt; &lt;!-- Data type: String --&gt; ]&gt; </pre> ! <h3><a id="ImageMetadata">Image Metadata</a></h3> The DTD for the TIFF native image metadata format is as follows: <pre> &lt;!DOCTYPE "javax_imageio_tiff_image_1.0" [
< prev index next >