jdk/src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html
author prr
Mon, 16 May 2011 15:38:56 -0700
changeset 9655 e19b80de8a7f
parent 5551 327690766109
child 14342 8435a30053c1
permissions -rw-r--r--
7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional. Reviewed-by: flar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
<head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
<!--
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     5
Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    10
published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    12
by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
5551
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    24
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    25
or visit www.oracle.com if you need additional information or have any
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    26
questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
<title>JPEG Metadata Format Specification and Usage Notes</title>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
</head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
<body bgcolor="white">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
<center><h1>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
JPEG Metadata Format Specification and Usage Notes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
</h1></center>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
<a href=#metadata>JPEG Metadata</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
<a href=#abbrev>Abbreviated Streams</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
<a href=#tables>Sources of Tables</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
<a href=#color>Colorspace Transformations and Conventional Markers</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
<a href=#thumbs>Thumbnail Images</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
<a href=#prog>Progressive Encoding</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
<a href=#tree>Native Metadata Format Tree Structure and Editing</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
<a href=#image>Image Metadata DTD</a><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
<a href=#stream>Stream Metadata DTD</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
<bold>NOTE</bold>: It is important to call <code>dispose()</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
on the JPEG reader and writer objects when they are no longer needed, as 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
they consume significant native resources which are not adequately recovered 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
by garbage collection.  Both reader and writer call <code>dispose()</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
in their finalizers, but those finalizers may not be called before the native 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
code has exhausted native memory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
The JPEG writer does not support replacing pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
<a name=metadata>JPEG Metadata</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
JPEG metadata consists of the data contained in marker segments in a JPEG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
stream.  The image metadata object returned from a read describes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
contents of the marker segments between the <code>SOI</code> marker and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
the <code>EOI</code> marker for that image.  The image metadata object 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
passed into a write determines the contents of the stream between the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
<code>SOI</code> marker and the <code>EOI</code> marker for that image, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
subject to the controls in any <code>ImageWriteParam</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
Stream metadata is used only for tables-only images found (or to be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
placed) at the beginning of a stream containing abbreviated images.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
Tables-only images are not treated as images and do not consume an 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
image index.  The stream metadata object returned from a read describes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
contents of the marker segments between the <code>SOI</code> marker and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
the <code>EOI</code> marker for the single tables-only image at the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
beginning of the stream, if one is present.  If no tables-only image is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
present at the front of the stream, the <code>getStreamMetadata</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
method of <code>ImageReader</code> returns <code>null</code>.  If 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
stream metadata is provided to the writer, a single tables-only image 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
containing the tables from the stream metadata object will be written at 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
the beginning of the stream.  If the stream metadata object contains no
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
tables, default tables will be written.  As the sole purpose of stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
metadata is for specifying tables-only images at the front of abbreviated 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
streams, the stream metadata argument is useful only on the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
<code>ImageWriter.prepareWriteSequence</code> method.  It is ignored on all 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
other methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
The <code>ImageWriter.getDefaultStreamMetadata</code> method returns an 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
object containing the tables from the <code>ImageWriteParam</code> argument, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
if it is a <code>JPEGImageWriteParam</code> and contains tables.  Otherwise, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
the returned object will contain default tables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
<p>The <code>ImageWriter.getDefaultImageMetadata</code> method returns a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
metadata object containing <bold>no</bold> tables if the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
<code>ImageWriteParam</code> argument contains tables.  Otherwise the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
returned metadata object will contain default visually lossless tables.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
Of course, only a <code>JPEGImageWriteParam</code> may contain tables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
If <code>ignoreMetadata</code> is set to <code>true</code> when the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
is set on the reader, stream metadata will not be available, but image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
metadata will.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
<a name=abbrev>Abbreviated Streams</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
Both the reader and the writer retain their tables from one operation to the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
next, thus permitting the use of abbreviated streams quite naturally, with a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
few minor restrictions:  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  <li> Abbreviated streams may contain only one tables-only image, which must 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
       come first in the stream.  Subsequent tables-only images will cause
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
       undefined behavior.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  <li> Abbreviated streams must be read fully and in order.  No random access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
       is allowed, in either direction.  The same image may be read multiple 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
       times.  If a call is made with an image index that is not the same as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
       or one greater than the most recent call (or 0 if no calls have been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
       made), then an <code>IllegalArgumentException</code> is thrown.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
These restrictions mean that streams may contain abbreviated images 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
interspersed with images containing tables.  As required by JPEG, any tables
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
appearing in the stream override previous tables, regardless of the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
of the previous tables.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
Note that once a tables-only image has been read, it's contents is available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
as stream metadata from the reader until either another tables-only image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
is read from another stream or the reader is reset.  Changing the input does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
not reset the stream metadata.  This is useful for reading the tables from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
one file, then changing the input to read an abbreviated stream containing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
a sequence of images.  The tables will be used automatically, and will remain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
available as "stream" metadata.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
Abbreviated streams are written using the sequence methods of 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
<code>ImageWriter</code>.  Stream metadata is used to write a tables-only 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
image at the beginning of the stream, and the tables are set up for use, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
<code>ImageWriter.prepareWriteSequence</code>.  If no stream metadata is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
supplied to <code>ImageWriter.prepareWriteSequence</code>, then no 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
tables-only image is written.  If stream metadata containing no tables is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
supplied to <code>ImageWriter.prepareWriteSequence</code>, then a tables-only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
image containing default visually lossless tables is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
<a name=tables>Sources of Tables</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
Images are written with tables if tables are present in their metadata objects 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
or without them if no tables are present in their metadata objects.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
metadata object is present then the tables are written.  The tables used for 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
compression are taken from one of the following sources, which are consulted 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
in order: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  <li> If there is an <code>ImageWriteParam</code> and the compression mode is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
       set to <code>EXPLICIT</code>, default tables constructed using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
       quality setting are used.  They are written only if the metadata 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
       contains tables or if there is no metadata, but they replace the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
       tables in the metadata.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
  <li> If there is an <code>ImageWriteParam</code> and the compression mode is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
       set to <code>DEFAULT</code>, default visually lossles tables are used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
       They are written only if the metadata contains tables or if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
       there is no metadata, but they replace the tables in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
       metadata.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
  <li> Otherwise the compression mode on the <code>ImageWriteParam</code> must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
       be MODE_COPY_FROM_<code>METADATA</code>, in which case the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
       are used:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      <li> the tables in the image metadata, if present</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      <li> the tables in the stream metadata, if present</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
      <li> the tables in the <code>JPEGImageWriteParam</code>, if present</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      <li> default visually lossless tables</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    </ol> Tables are written only if they are taken from image metadata.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  </li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
This ordering implements the design intention that tables should be included 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
in <code>JPEGImageWriteParam</code>s only as a means of specifying tables 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
when no other source is available, and this can occur only when writing to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
abbreviated stream without tables using known non-standard tables for 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
compression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
When reading, tables in a <code>JPEGImageReadParam</code> are consulted only 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
if tables have not been set by any previous read.  Tables set from a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
<code>JPEGImageReadParam</code> are overridden by any tables present in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
stream being read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
Note that if no image metadata object is specified for a particular image, a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
default object is used, which includes default tables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
<a name=color>Colorspace Transformations and Conventional Markers</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
Colorspace transformations are controlled by the destination type for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
both reading and writing of images.  When <code>Raster</code>s are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
read, no colorspace transformation is performed, and any destination type 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
is ignored.  A warning is sent to any listeners if a destination type is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
specified in this case.  When <code>Raster</code>s are written, any 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
destination type is used to interpret the bands.  This might result in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
JFIF or Adobe header being written, or different component ids being written 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
to the frame and scan headers.  If values present in a metadata object do not 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
match the destination type, the destination type is used and a warning is sent 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
to any listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   214
<a name=optcolor><b>Optional ColorSpace support:</b></a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   215
Handling of PhotoYCC (YCC), PhotoYCCA (YCCA), RGBA and YCbCrA color spaces
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   216
by the standard plugin, as described below, is dependent on capabilities
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   217
of the libraries used to interpret the JPEG data. Thus all consequential
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   218
behaviors are optional. If the support is not available when decoding,
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   219
the color space will be treated as unrecognized and the appropriate
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   220
default color space for the specified number of component channels
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   221
may be used.
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   222
When writing, an Exception may be thrown if no suitable conversion
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   223
can be applied before encoding.
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   224
But where the support for these color spaces is available, the behavior
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   225
must be as documented. 
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   226
<p>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   227
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
When reading, the contents of the stream are interpreted by the usual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
JPEG conventions, as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
  <li> If a JFIF <code>APP0</code> marker segment is present, the colorspace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
       is known to be either grayscale or YCbCr.  If an <code>APP2</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
       marker segment containing an embedded ICC profile is also present, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
       the YCbCr is converted to RGB according to the formulas given in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
       JFIF spec, and the ICC profile is assumed to refer to the resulting RGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
       space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
  <li> If an Adobe <code>APP14</code> marker segment is present, the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
       colorspace is determined by consulting the <code>transform</code> flag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
       The <code>transform</code> flag takes one of three values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      <li> 2 - The image is encoded as YCCK (implicitly converted from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
           CMYK on encoding).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      <li> 1 - The image is encoded as YCbCr (implicitly converted from RGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
           on encoding).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      <li> 0 - Unknown.  3-channel images are assumed to be RGB, 4-channel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
           images are assumed to be CMYK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
   <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
  <li> If neither marker segment is present, the following procedure is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
       followed: Single-channel images are assumed to be grayscale, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
       2-channel images are assumed to be grayscale with an alpha channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
       For 3- and 4-channel images, the component ids are consulted.  If these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
       values are 1-3 for a 3-channel image, then the image is assumed to be
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   258
       YCbCr. Subject to the availability of the
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   259
       <a href=#optcolor>optional color space support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   260
       described above, if these values are 1-4 for a 4-channel image,
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   261
       then the image is assumed to be YCbCrA. 
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   262
       If these values are > 4, they are checked 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
       against the ASCII codes for 'R', 'G', 'B', 'A', 'C', 'c'.  These can 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
       encode the following colorspaces:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
       <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
       <br>RGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
       <br>RGBA
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
       <br>YCC (as 'Y','C','c'), assumed to be PhotoYCC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
       <br>YCCA (as 'Y','C','c','A'), assumed to be PhotoYCCA
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
       <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
       Otherwise, 3-channel subsampled images are assumed to be YCbCr, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
       3-channel non-subsampled images are assumed to be RGB, 4-channel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
       subsampled images are assumed to be YCCK, and 4-channel, non-subsampled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
       images are assumed to be CMYK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
  <li> All other images are declared uninterpretable and an exception is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
       thrown if an attempt is made to read one as a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
       <code>BufferedImage</code>.  Such an image may be read only as a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
       <code>Raster</code>.  If an image is interpretable but there is no Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
       <code>ColorSpace</code> available corresponding to the encoded 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
       colorspace (<italic>e.g.</italic> YCbCr), then 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
       <code>ImageReader.getRawImageType</code> will return <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
Once an encoded colorspace is determined, then the target colorspace is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
determined as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
  <li> If a destination type is not set, then the following default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
       transformations take place after upsampling: YCbCr (and YCbCrA) images 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
       are converted to RGB (and RGBA) using the conversion provided by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
       underlying IJG library and either the built-in sRGB 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
       <code>ColorSpace</code> or a custom RGB <code>ColorSpace</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
       based on an embedded ICC profile is used to create the output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
       <code>ColorModel</code>.  PhotoYCC and PhotoYCCA images are not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
       converted.  CMYK and YCCK images are currently not supported.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
  <li> If a destination image or type is set, it is used as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
       If the IJG library provides an appropriate conversion, it is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
       Otherwise the default library conversion is followed by a colorspace 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
       conversion in Java.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
  <li> Bands are selected AFTER any library colorspace conversion.  If a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
       subset of either source or destination bands is used, then the default 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
       library conversions are used with no further conversion in Java,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
       regardless of any destination type.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
  <li> An exception is thrown if an attempt is made to read an image in an 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
       unsupported jpeg colorspace as a <code>BufferedImage</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
       (<italic>e.g.</italic> CMYK).  Such images may be read as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
       <code>Raster</code>s.  If an image colorspace is unsupported or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
       uninterpretable, then <code>ImageReader.getImageTypes</code> will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
       return an empty <code>Iterator</code>.   If a subset of the raw bands
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
       are required, a <code>Raster</code> must be obtained first and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
       bands obtained from that. </li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
For writing, the color transformation to apply is determined as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
If a subset of the source bands is to be written, no color conversion is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
performed.  Any destination, if set, must match the number of bands that will 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
be written, and serves as an interpretation of the selected bands, rather than 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
a conversion request.  This behavior is identical to that for 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
<code>Raster</code>s.  If all the bands are to be written and an image 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
(as opposed to a <code>Raster</code>) is being written, any destination type 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
is ignored and a warning is sent to any listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
If a destination type is used and any aspect of the metadata object, if there 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
is one, is not compatible with that type, the destination type is used, the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
metadata written is modified from that provided, and a warning is sent to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
listeners.  This includes the <code>app0JFIF</code> and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
<code>app14Adobe</code> nodes.  The component ids in the <code>sof</code> and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
<code>sos</code> nodes are not modified, however, as unless a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
<code>app0JFIF</code> node is present, any values may be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
When a full image is written, a destination colorspace will be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
chosen based on the image contents and the metadata settings, according to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
the following algorithm:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
If no metadata object is specified, then the following defaults apply:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
  <li> Grayscale images are written with a JFIF <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
       segment.  Grayscale images with alpha are written with no special
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
       marker.  As required by JFIF, the component ids in the frame and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
       scan header is set to 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  <li> RGB images are converted to YCbCr, subsampled in the chrominance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
       channels by half both vertically and horizontally, and written with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
       JFIF <code>APP0</code> marker segment.  If the <code>ColorSpace</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
       of the image is based on an <code>ICCProfile</code> (it is an instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
       of <code>ICC_ColorSpace</code>, but is not one of the standard built-in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
       <code>ColorSpaces</code>), then that profile is embedded in an 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
       <code>APP2</code> marker segment.  As required by JFIF, the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
       component ids in the frame and scan headers are set to 1, 2, and 3.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   366
  <li> Subject to the <a href=#optcolor>optional library support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   367
        described above,
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   368
       RGBA images are converted to YCbCrA, subsampled in the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
       chrominance channels by half both vertically and horizontally, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
       written without any special marker segments.  The component ids 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
       in the frame and scan headers are set to 1, 2, 3, and 4.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   373
  <li> Subject to the <a href=#optcolor>optional library support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   374
       described above,
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   375
       PhotoYCC and YCCAimages are subsampled by half in the chrominance
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
       channels both vertically and horizontally and written with an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
       Adobe <code>APP14</code> marker segment and 'Y','C', and 'c' (and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
       'A' if an alpha channel is present) as component ids in the frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        and scan headers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
Default metadata objects for these image types will reflect these settings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
If a metadata object is specified, then the number of channels in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
frame and scan headers must always match the number of bands to be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
written, or an exception is thrown.  <code>app0JFIF</code> and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
<code>app14Adobe</code> nodes may appear in the same metadata object only 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
if the <code>app14Adobe</code> node indicates YCbCr, and the component ids 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
are JFIF compatible (0-2).  The various image types are processed in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
following ways:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
(All multi-channel images are subsampled according to the sampling factors 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
in the frame header node of the metadata object, regardless of color space.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
  <li> Grayscale Images:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
           a JFIF <code>APP0</code> marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      <li> If an <code>app14Adobe</code> node is present in the metadata 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
           object, it is checked for validity (<code>transform</code> must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
           <code>UNKNOWN</code>) and written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
      <li> If neither node is present in the metadata object, no special 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
           marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
  <li> Grayscale Images with an Alpha Channel:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
           it is ignored and a warning is sent to listeners, as JFIF does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
           support 2-channel images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
      <li> If an <code>app14Adobe</code> node is present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
           object, it is checked for validity (<code>transform</code> must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
           <code>UNKNOWN</code>) and written.  If <code>transform</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
           not <code>UNKNOWN</code>, a warning is sent to listeners and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
           correct transform is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      <li> If neither node is present in the metadata object, no special 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
           marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
  <li> RGB Images:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
           the image is converted to YCbCr and written with a JFIF 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
           <code>APP0</code> marker segment.  If the <code>ColorSpace</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
           of the image is based on a non-standard ICC Profile, then that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
           profile is embedded in an <code>APP2</code> marker segment.  If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
           <code>ColorSpace</code> is not based on a non-standard ICC Profile,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
           but an <code>app2ICC</code> node appears in the metadata, then an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
           <code>APP2</code> marker segment is written with the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
           standard profile.  Note that the profile must specify an RGB color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
           space, as the file must be JFIF compliant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
      <li> If an <code>app14Adobe</code> node is present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
           object, the image is converted according to the color transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
           setting and written with an Adobe <code>APP14</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
           segment.  Component ids are written just as they appear in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
           frame and scan headers.  The color transform must be either YCbCr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
           or <code>UNKNOWN</code>.  If it is <code>UNKNOWN</code>, the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
           is not color converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
      <li> If neither node is present, the component ids in the frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
           header are consulted.  If these indicate a colorspace as described
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
           above, then the image is converted to that colorspace if possible.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
           If the component ids do not indicate a colorspace, then the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
           sampling factors are consulted.  If the image is to be subsampled,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
           it is converted to YCbCr first.  If the image is not to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
           subsampled, then no conversion is applied.  No special marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
           segmentss are written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
  <li> RGBA images:
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   457
       Subject to the <a href=#optcolor>optional library support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   458
       described above,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
           it is ignored and a warning is sent to listeners, as JFIF does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
           support 4-channel images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
      <li> If an <code>app14Adobe</code> node is present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
           object, the image is written with an Adobe <code>APP14</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
           segment.  No colorspace conversion is performed.  Component ids
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
           are written just as they appear in the frame and scan  headers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
           The color transform must be <code>UNKNOWN</code>.  If it is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
           not, a warning is sent to listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
      <li> If no <code>app14Adobe</code> node is present, the component ids in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
           the frame header are consulted.  If these indicate a colorspace as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
           described above, then the image is converted to that colorspace if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
           possible.  If the component ids do not indicate a colorspace, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
           the sampling factors are consulted.  If the image is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
           subsampled, it is converted to YCbCrA.  If the image is not to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
           subsampled, then no conversion is applied.  No special marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
           segments are written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
  <li> PhotoYCC Images:
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   482
       Subject to the <a href=#optcolor>optional library support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   483
       described above,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
           the image is converted to sRGB, and then to YCbCr during encoding,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
           and a JFIF <code>APP0</code> marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
      <li> If an <code>app14Adobe</code> node is present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
           object, no conversion is applied, and an Adobe <code>APP14</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
           marker segment is written.  The color transform must be YCC.  If it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
           is not, a warning is sent to listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
      <li> If neither node is present in the metadata object, no conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
           is applied, and no special marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
  <li> PhotoYCCA Images:
9655
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   499
       Subject to the <a href=#optcolor>optional library support</a>
e19b80de8a7f 7044682: Image I/O JPEG Metadata spec. should document that PhotoYCC ColorSpace interpretation is optional.
prr
parents: 5551
diff changeset
   500
       described above,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
      <li> If an <code>app0JFIF</code> node is present in the metadata object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
           it is ignored and a warning is sent to listeners, as JFIF does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
           support 4-channel images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      <li> If an <code>app14Adobe</code> node is present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
           object, no conversion is applied, and an Adobe <code>APP14</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
           marker segment is written.  The color transform must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
           <code>UNKNOWN</code>.  If it is not, a warning is sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
           listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      <li> If neither node is present in the metadata object, no conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
           is applied, and no special marker segment is written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
<a name=thumbs>Thumbnail Images</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
Thumbnails are supported by the use of JFIF and JFIF extension marker segments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
Thumbnails provided on the write methods determine the thumbnails that will be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
included.  <code>app0JFIF</code> and <code>app0JFXX</code> nodes present in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
the metadata do not contain any thumbnail pixel data.  However, the kinds of 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
thumbnails written depend on the contents of the metadata object, as follows.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
Any thumbnail which is to be written as an indexed or RGB image and which is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
larger than 255 by 255 will be clipped, not scaled, to 255 by 255.  Thumbnails 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
written as JPEG images may be any size.  A warning is sent to any listeners 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
whenever a thumbnail is clipped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
  <li> If there is a single thumbnail, it is processed as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
      <li> If the thumbnail image is an RGB palette image, it is processed as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
           follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
          <li> If no <code>app0JFXX</code> node is present in the metadata, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
               the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
               contains a <code>JFIFthumbPalette</code> element, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
               palette thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
               segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
               contains another thumbnail form (RGB or JPEG), the palette
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
               image is expanded to RGB and the indicated thumbnail form is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
               written.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
      <li> If the thumbnail image is an RGB image, it is processed as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
          <li> If no <code>app0JFXX</code> node is present in the metadata,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
               the thumbnail is written as part of the JFIF <code>APP0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
               marker segment. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
               contains a <code>JFIFthumbRGB</code> element, an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
               RGB thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
               segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
               contains a <code>JFIFthumbJPEG</code> element, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
               JPEG thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
               segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
               contains a <code>JFIFthumbPalette</code> element, an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
               RGB thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
               segment and a warning is sent to any listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
      <li> If the thumbnail image is a grayscale image, it is processed as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
           follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
          <li> If no <code>app0JFXX</code> node is present in the metadata,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
               the thumbnail is expanded to RGB and written as part of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
               JFIF <code>APP0</code> marker segment. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
               contains a <code>JFIFthumbRGB</code> element, the thumbnail is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
               expanded to RGB and written in a separate <code>JFXX</code> RGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
               marker segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
               contains a <code>JFIFthumbJPEG</code> element, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
               JPEG thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
               segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
          <li> If the first <code>app0JFXX</code> node present in the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
               contains a <code>JFIFthumbPalette</code> element, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
               JPEG thumbnail is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
               segment and a warning is sent to any listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
      <li> Any other thumbnail image types are ignored and a warning is sent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
           to any listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
  <li> If there are multiple thumbnails, each one is processed as above, except
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
       that no thumbnail is placed in the JFIF <code>APP0</code> segment, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
       the <code>app0JFXX</code> node consulted for each thumbnail is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
       <code>app0JFXX</code> node from the metadata that occurs in the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
       sequence as the thumbnail.  <italic>I.e.</italic> the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
       <code>app0JFXX</code> node applies to the first thumbnail, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
       node to the second thumbnail, and so on.  If there are fewer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
       <code>app0JFXX</code> nodes in the metadata than thumbnails, then 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
       those thumbnails are considered to have no matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
       <code>app0JFXX</code> node.  An RGB thumbnail with no matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
       <code>app0JFXX</code> node is written in a JFXX <code>APP0</code> marker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
       segment.  A grayscale thumbnail with no matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
       <code>app0JFXX</code> node is written as a JPEG image to a JFXX 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
       <code>APP0</code> marker segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
Note that as the only mechanism for storing thumbnails is via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
JFIF or JFIF extension marker segments, only grayscale or RGB images 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
may have thumbnails.  If thumbnails are present when writing any other type 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
of image, the thumbnails are ignored and a warning is sent to any warning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
<a name=prog>Progressive Encoding</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
Progressive encoding must be enabled on the <code>ImageWriteParam</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
passed in to a write operation, or the image will be written sequentially,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
regardless of the scan headers included in the metadata object.  If 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
progressive encoding is enabled and set to copy from metadata, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
the sequence of scan headers from the metadata is used to write the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
image.  If progressive encoding is enabled and set to use a default, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
then the scans in the metadata are ignored and a default set of scans 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
is used.  Progressive encoding always forces optimized Huffman tables to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
be used.  Any Huffman tables present in the metadata will be ignored,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
and a warning will be sent to any warning listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
If Huffman-table optimization is requested on the <code>ImageWriteParam</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
all Huffman tables in the metadata or in the <code>ImageWriteParam</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
itself are ignored, and a warning will be sent to any warning listeners if 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
any such tables are present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
<a name=tree>Native Metadata Format Tree Structure and Editing</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
The DTDs below describe just the trees of metadata objects actually returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
by the <code>IIOMetadata</code> object.  They do not include nodes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
corresponding to <code>SOI</code>, <code>EOI</code>, or <code>RST</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
markers, as these parsing delimiters do not carry any meaningful metadata.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
The first node is always a <code>JPEGvariety</code> node.  In the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
<code>javax_imageio_jpeg_image_1.0</code> version of the JPEG metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
format, this node may have one child, an <code>app0JFIF</code> node,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
indicating that the JPEG stream contains a JFIF marker segment and related
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
data, or no children, indicating that the stream contains no JFIF marker.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
In future versions of the JPEG metadata format, other varieties of JPEG
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
metadata may be supported (e.g. Exif) by defining other types of nodes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
which may appear as a child of the <code>JPEGvariety</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
(Note that an application wishing to interpret Exif metadata given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
a metadata tree structure in the <code>javax_imageio_jpeg_image_1.0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
format must check for an <code>unknown</code> marker segment with a tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
indicating an <code>APP1</code> marker and containing data identifying it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
as an Exif marker segment.  Then it may use application-specific code to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
interpret the data in the marker segment.  If such an application were
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
to encounter a metadata tree formatted according to a future version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
the JPEG metadata format, the Exif marker segment might not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
<code>unknown</code> in that format - it might be structured as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
child node of the <code>JPEGvariety</code> node.  Thus, it is important
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
for an application to specify which version to use by passing the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
identifying the version to the method/constructor used to obtain an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
<code>IIOMetadata</code> object.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
On reading, <code>JFXX</code> and <code>app2ICC</code> nodes occur as 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
children of an <code>app0JFIF</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
This is true regardless of where the JFXX <code>APP0</code> and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
<code>APP2</code> marker segments actually occur in the stream.  The ordering 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
of nodes within the <code>markerSequence</code> node corresponds to the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
ordering of marker segments found in the JPEG stream.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
On writing, any <code>JFXX</code> and <code>app2ICC</code> nodes must 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
occur as children of an <code>app0JFIF</code> node, itself a child of a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
<code>JPEGvariety</code> node, which must always be the first node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
(If the stream is not to be JFIF compliant, no <code>app0JFIF</code> node
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
should be provided, and the <code>JPEGvariety</code> node should have no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
children.)  Any 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
JFIF <code>APP0</code>, JFXX <code>APP0</code>, and <code>APP2</code> marker 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
segments are written first, followed by all Adobe <code>APP14</code>, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
<code>APPn</code>, <code>COM</code> and unknown segments in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
order in which their corresponding nodes appear in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
<code>markerSequence</code> node, followed by <code>DQT</code> (and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
<code>DHT</code> for non-progressive writes) marker segments, followed by the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
<code>SOF</code> and <code>SOS</code> marker segments.  For progressive writes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
using metadata to control progression, the <code>SOS</code> segments are used 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
in the order in which their corresponding nodes occur in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
<code>markerSequence</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
The <code>reset</code>, <code>mergeTree</code> and <code>setFromTree</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
operations have the following semantics for the JPEG plug-in metadata object:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
<p> <code>reset</code> - A call to <code>reset</code> will restore the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
metadata object to the same state it had immediately after creation, whether 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
this came about from reading a stream or by obtaining a default object from 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
the <code>ImageWriter</code>.  This is true regardless of how many times the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
metadata object has been modified since creation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
<p> <code>mergeTree</code> - Native Format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
<br> The <code>mergeTree</code> operation accepts valid trees conforming to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
the DTD below, and merges the nodes using the following ordering rules.  In 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
all cases, only data present in the new node is changed in a corresponding 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
existing node, if any.  This means that nodes cannot be removed using 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
<code>mergeTree</code>.  To remove nodes, use <code>setFromTree</code>.  The 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
tree must consist of <code>IIOMetadataNode</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
  <li> <code>app0JFIF</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
          <li> If an <code>app0JFIF</code> node already exists, the contents 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
               of the new one modify the existing one. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
          <li> If there is no such node, a new one is created and inserted in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
               the appropriate position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
        </ul>    
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
  <li> <code>dqt</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
          <li> If there already exist <code>dqt</code> nodes in the sequence,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
               then each table in the node replaces the first table, in any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
               <code>dqt</code> node, with the same table id.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
          <li> If none of the existing <code>dqt</code> nodes contain a table
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
               with the same id, then the table is added to the last existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
               <code>dqt</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
          <li> If there are no <code>dqt</code> nodes, then a new one is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
               created and added as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
              <li> If there are <code>dht</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                   <code>dqt</code> node is inserted before the first one.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
              <li> If there are no <code>dht</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                   <code>dqt</code> node is inserted  before an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
                   <code>sof</code> node, if there is one. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
              <li> If there is no <code>sof</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
                   <code>dqt</code> node is inserted before the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
                   <code>sos</code> node, if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
              <li> If there is no <code>sos</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
                   <code>dqt</code> node is added to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
  <li> <code>dht</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
          <li> If there already exist <code>dht</code> nodes in the sequence,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
               then each table in the node replaces the first table, in any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
               <code>dht</code> node, with the same table class and table id.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
          <li> If none of the existing <code>dht</code> nodes contain a table
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
               with the same class and id, then the table is added to the last
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
               existing <code>dht</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
          <li> If there are no <code>dht</code> nodes, then a new one is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
               created and added as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
              <li> If there are <code>dqt</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                   <code>dht</code> node is inserted immediately following the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
                   last <code>dqt</code> node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
              <li> If there are no <code>dqt</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
                   <code>dht</code> node is inserted before an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
                   <code>sof</code> node, if there is one. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
              <li> If there is no <code>sof</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                   <code>dht</code> node is inserted before the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                   <code>sos</code> node, if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
              <li> If there is no <code>sos</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                   <code>dht</code> node is added to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
  <li> <code>dri</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
          <li> If there already exists a <code>dri</code> node, the restart 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
               interval value is updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
          <li> If there is no <code>dri</code> node, then a new one is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
               and added as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
              <li> If there is an <code>sof</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                   <code>dri</code> node is inserted before it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
              <li> If there is no <code>sof</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
                   <code>dri</code> node is inserted before the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
                   <code>sos</code> node, if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
              <li> If there is no <code>sos</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
                   <code>dri</code> node is added to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
  <li> <code>com</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        <br> A new <code>com</code> node is created and inserted as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
          <li> If there already exist <code>com</code> nodes, the new one is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
               inserted after the last one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
          <li> If there are no <code>com</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
               <code>com</code> node is inserted after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
               <code>app14Adobe</code> node, if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
          <li> If there is no <code>app14Adobe</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
               <code>com</code> node is inserted at the beginning of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
               sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
  <li> <code>app14Adobe</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
          <li> If there already exists an <code>app14Adobe</code> node, then 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
               its attributes are updated from the node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
          <li> If there is no <code>app14Adobe</code> node, then a new one is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
               created and  added as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
            <ul> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
              <li> The new <code>app14Adobe</code> node is inserted after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
                   last <code>unknown</code> node, if there are any.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
              <li> If there are no <code>unknown</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
                   <code>app14Adobe</code> node is inserted at the beginning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                   of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
  <li> <code>unknown</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
       <br> A new <code>unknown</code> node is created and added to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
            sequence as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
          <li> If there already exist <code>unknown</code> marker nodes, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
               new one is inserted after the last one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
          <li> If there are no <code>unknown</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
               <code>unknown</code> node is inserted before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
               <code>app14Adobe</code> node, if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
          <li> If there is no <code>app14Adobe</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
               <code>unknown</code> node is inserted at the beginning of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
               sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
  <li> <code>sof</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
          <li> If there already exists an <code>sof</code> node in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
               sequence, then its values are updated from the node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
          <li> If there is no <code>sof</code> node, then a new one is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
               and added as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
              <li> If there are any <code>sos</code> nodes, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
                   <code>sof</code> node is inserted before the first one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
              <li> If there is no <code>sos</code> node, the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
                   <code>sof</code> node is added to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
  <li> <code>sos</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
          <li> If there already exists a single <code>sos</code> node, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
               the values are updated from the node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
          <li> If there are more than one existing <code>sos</code> nodes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
               then an <code>IIOInvalidTreeException</code> is thrown, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
               <code>sos</code> nodes cannot be merged into a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
               progressive scans.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
          <li> If there are no <code>sos</code> nodes, a new one is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
               and added to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
<p> <code>mergeTree</code> - Standard Format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
The <code>mergeTree</code> operation, when given a tree in the standard 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
format, will modify the native tree in the following ways:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
   <li> <code>Chroma</code> - The <code>ColorSpaceType</code> subnode of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
        <code>Chroma</code> node may change the target colorspace of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        compressed image.  The selection of a new colorspace can cause a number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
        of changes, in keeping with the algorithms described above: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
        <code>app0JFIF</code> and <code>app14Adobe</code> nodes may be added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
        or removed, subsampling may be added or removed, component ids may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
        be changed, and <code>sof</code> and <code>sos</code> nodes will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
        updated accordingly.  If necessary, additional quantization and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
        huffman tables are added.  In the case of quantization tables, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
        default will be scaled to match the quality level of any existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
        tables.  No tables are added to metadata that does not already contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
        tables.  If the existing metadata specifies progressive encoding, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
        the number of channels must not change.  Any <code>Transparency</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
        node is also taken into account, as an explicit value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
        <code>none</code> for the <code>Alpha</code> subnode can cause the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        removal of an alpha channel, and anything other than <code>none</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
        can cause the addition of an alpha channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
   <li> <code>Dimension</code> - A <code>PixelAspectRatio</code> specification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
        can cause the contents of an <code>app0JFIF</code> node to change, if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        there is one present, or the addition of an <code>app0JFIF</code> node
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
        containing appropriate values, if there can be one.  An appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
        pair of integers is computed from the floating-point ratio for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
        inclusion in the node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
   <li> <code>Text</code> - Each uncompressed text item is converted to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
        <code>com</code> node and inserted according to the rules above for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
        merging <code>com</code> nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
<p> <code>setFromTree</code> - Native Format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
The <code>setFromTree</code> operation, when given a tree in the native 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
format described below, will simply replace the existing tree in its entirety 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
with the new one.  The tree must consist of <code>IIOMetadataNode</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
<p> <code>setFromTree</code> - Standard Format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
The <code>setFromTree</code> operation, when given a tree in the standard 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
format, performs a <code>reset</code> followed by a merge of the new tree.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
<a name=image>Image Metadata DTD</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
&lt;!DOCTYPE "javax_imageio_jpeg_image_1.0" [
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
  &lt;!ELEMENT "javax_imageio_jpeg_image_1.0" (JPEGvariety, markerSequence)&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
    &lt;!ELEMENT "JPEGvariety" (app0JFIF)&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
      &lt;!-- A node grouping all marker segments specific to the variety of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
              stream being read/written (e.g. JFIF) - may be empty --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
      &lt;!ELEMENT "app0JFIF" (JFXX?, app2ICC?)&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
        &lt;!ATTLIST "app0JFIF" "majorVersion" #CDATA "1"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
          &lt;!-- The major JFIF version number --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
        &lt;!ATTLIST "app0JFIF" "minorVersion" #CDATA "2"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
          &lt;!-- The minor JFIF version number --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
        &lt;!ATTLIST "app0JFIF" "resUnits" ("0" | "1" | "2") "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
          &lt;!-- The resolution units for Xdensisty and Ydensity (0 = no 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
               units, just aspect ratio; 1 = dots/inch; 2 = dots/cm) --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
        &lt;!ATTLIST "app0JFIF" "Xdensity" #CDATA "1"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
          &lt;!-- The horizontal density or aspect ratio numerator --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
          &lt;!-- Min value: 1 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
        &lt;!ATTLIST "app0JFIF" "Ydensity" #CDATA "1"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
          &lt;!-- The vertical density or aspect ratio denominator --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
          &lt;!-- Min value: 1 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
        &lt;!ATTLIST "app0JFIF" "thumbWidth" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
          &lt;!-- The width of the thumbnail, or 0 if there isn't one --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
        &lt;!ATTLIST "app0JFIF" "thumbHeight" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
          &lt;!-- The height of the thumbnail, or 0 if there isn't one --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
        &lt;!ELEMENT "JFXX" (app0JFXX)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
          &lt;!-- Min children: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
        &lt;!ELEMENT "app0JFXX" (JFIFthumbJPEG | JFIFthumbPalette | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
          JFIFthumbRGB)&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
          &lt;!-- A JFIF extension marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
          &lt;!ATTLIST "app0JFXX" "extensionCode" ("16" | "17" | "19")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
             #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
            &lt;!-- The JFXX extension code identifying thumbnail type: (16 = 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
                 JPEG, 17 = indexed, 19 = RGB --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
          &lt;!ELEMENT "JFIFthumbJPEG" (markerSequence?)&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
            &lt;!-- A JFIF thumbnail in JPEG format (no JFIF segments 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
                 permitted) --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
          &lt;!ELEMENT "JFIFthumbPalette" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
            &lt;!-- A JFIF thumbnail as an RGB indexed image --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
            &lt;!ATTLIST "JFIFthumbPalette" "thumbWidth" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
              &lt;!-- The width of the thumbnail --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
              &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
              &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
              &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            &lt;!ATTLIST "JFIFthumbPalette" "thumbHeight" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
              &lt;!-- The height of the thumbnail --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
              &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
              &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
              &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
          &lt;!ELEMENT "JFIFthumbRGB" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
            &lt;!-- A JFIF thumbnail as an RGB image --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            &lt;!ATTLIST "JFIFthumbRGB" "thumbWidth" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
              &lt;!-- The width of the thumbnail --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
              &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
              &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
              &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
            &lt;!ATTLIST "JFIFthumbRGB" "thumbHeight" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
              &lt;!-- The height of the thumbnail --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
              &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
              &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
              &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        &lt;!ELEMENT "app2ICC" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
          &lt;!-- An ICC profile APP2 marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
          &lt;!-- Optional User object: java.awt.color.ICC_Profile --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
    &lt;!ELEMENT "markerSequence" (dqt | dht | dri | com | unknown | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
      app14Adobe | sof | sos)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
      &lt;!-- A node grouping all non-jfif marker segments --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
      &lt;!ELEMENT "dqt" (dqtable)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
        &lt;!-- A Define Quantization Table(s) marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
        &lt;!-- Min children: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
        &lt;!-- Max children: 4 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
        &lt;!ELEMENT "dqtable" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
          &lt;!-- A single quantization table --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
          &lt;!-- User object: javax.imageio.plugins.jpeg.JPEGQTable --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
          &lt;!ATTLIST "dqtable" "elementPrecision" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
            &lt;!-- The number of bits in each table element (0 = 8, 1 = 16) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
                 --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
            &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
          &lt;!ATTLIST "dqtable" "qtableId" ("0" | "1" | "2" | "3") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
      &lt;!ELEMENT "dht" (dhtable)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
        &lt;!-- A Define Huffman Table(s) marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
        &lt;!-- Min children: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        &lt;!-- Max children: 4 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
        &lt;!ELEMENT "dhtable" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
          &lt;!-- A single Huffman table --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
          &lt;!-- User object: javax.imageio.plugins.jpeg.JPEGHuffmanTable --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
          &lt;!ATTLIST "dhtable" "class" ("0" | "1") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
            &lt;!-- Indicates whether this is a DC (0) or an AC (1) table --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
          &lt;!ATTLIST "dhtable" "htableId" ("0" | "1" | "2" | "3") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
            &lt;!-- The table id --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
      &lt;!ELEMENT "dri" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
        &lt;!-- A Define Restart Interval marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
        &lt;!ATTLIST "dri" "interval" #CDATA #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
          &lt;!-- The restart interval in MCUs --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
      &lt;!ELEMENT "com" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
        &lt;!-- A Comment marker segment. The user object contains the actual 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
             bytes. --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
        &lt;!-- User object: array of [B --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
        &lt;!-- Min length: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
        &lt;!-- Max length: 65533 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        &lt;!ATTLIST "com" "comment" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
          &lt;!-- The comment as a string (used only if user object is null) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
               --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
          &lt;!-- Data type: String --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
      &lt;!ELEMENT "unknown" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
        &lt;!-- An unrecognized marker segment. The user object contains the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
             data not including length. --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
        &lt;!-- User object: array of [B --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        &lt;!-- Min length: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
        &lt;!-- Max length: 65533 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
        &lt;!ATTLIST "unknown" "MarkerTag" #CDATA #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
          &lt;!-- The tag identifying this marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
      &lt;!ELEMENT "app14Adobe" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
        &lt;!-- An Adobe APP14 marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
        &lt;!ATTLIST "app14Adobe" "version" #CDATA "100"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
          &lt;!-- The version of Adobe APP14 marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
          &lt;!-- Min value: 100 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
          &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
        &lt;!ATTLIST "app14Adobe" "flags0" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
          &lt;!-- The flags0 variable of an APP14 marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
        &lt;!ATTLIST "app14Adobe" "flags1" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
          &lt;!-- The flags1 variable of an APP14 marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        &lt;!ATTLIST "app14Adobe" "transform" ("0" | "1" | "2") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
          &lt;!-- The color transform applied to the image (0 = Unknown, 1 = 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
               YCbCr, 2 = YCCK) --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
      &lt;!ELEMENT "sof" (componentSpec)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
        &lt;!-- A Start Of Frame marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
        &lt;!-- Min children: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
        &lt;!-- Max children: 4 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        &lt;!ATTLIST "sof" "process" ("0" | "1" | "2") #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
          &lt;!-- The JPEG process (0 = Baseline sequential, 1 = Extended 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
               sequential, 2 = Progressive) --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
        &lt;!ATTLIST "sof" "samplePrecision" #CDATA "8"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
          &lt;!-- The number of bits per sample --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        &lt;!ATTLIST "sof" "numLines" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
          &lt;!-- The number of lines in the image --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
        &lt;!ATTLIST "sof" "samplesPerLine" #CDATA #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
          &lt;!-- The number of samples per line --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
          &lt;!-- Max value: 65535 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
        &lt;!ATTLIST "sof" "numFrameComponents" ("1" | "2" | "3" | "4")
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
           #IMPLIED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
          &lt;!-- The number of components in the image --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
        &lt;!ELEMENT "componentSpec" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
          &lt;!-- A component specification for a frame --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
          &lt;!ATTLIST "componentSpec" "componentId" #CDATA #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
            &lt;!-- The id for this component --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
            &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
            &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
            &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
          &lt;!ATTLIST "componentSpec" "HsamplingFactor" #CDATA #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
            &lt;!-- The horizontal sampling factor for this component --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
            &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
            &lt;!-- Min value: 1 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
            &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
          &lt;!ATTLIST "componentSpec" "VsamplingFactor" #CDATA #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
            &lt;!-- The vertical sampling factor for this component --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
            &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
            &lt;!-- Min value: 1 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
            &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
          &lt;!ATTLIST "componentSpec" "QtableSelector" ("0" | "1" | "2" | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
            "3") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
            &lt;!-- The quantization table to use for this component --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
      &lt;!ELEMENT "sos" (scanComponentSpec)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
        &lt;!-- A Start Of Scan marker segment --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
        &lt;!-- Min children: 1 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
        &lt;!-- Max children: 4 --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
        &lt;!ATTLIST "sos" "numScanComponents" ("1" | "2" | "3" | "4")
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
           #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
          &lt;!-- The number of components in the scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
        &lt;!ATTLIST "sos" "startSpectralSelection" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
          &lt;!-- The first spectral band included in this scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
          &lt;!-- Max value: 63 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
        &lt;!ATTLIST "sos" "endSpectralSelection" #CDATA "63"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
          &lt;!-- The last spectral band included in this scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
          &lt;!-- Max value: 63 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
        &lt;!ATTLIST "sos" "approxHigh" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
          &lt;!-- The highest bit position included in this scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
          &lt;!-- Max value: 15 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
        &lt;!ATTLIST "sos" "approxLow" #CDATA "0"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
          &lt;!-- The lowest bit position included in this scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
          &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
          &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
          &lt;!-- Max value: 15 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
        &lt;!ELEMENT "scanComponentSpec" EMPTY&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
          &lt;!-- A component specification for a scan --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
          &lt;!ATTLIST "scanComponentSpec" "componentSelector" #CDATA
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
             #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
            &lt;!-- The id of this component --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
            &lt;!-- Data type: Integer --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
            &lt;!-- Min value: 0 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
            &lt;!-- Max value: 255 (inclusive) --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
          &lt;!ATTLIST "scanComponentSpec" "dcHuffTable" ("0" | "1" | "2" | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
            "3") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
            &lt;!-- The huffman table to use for encoding DC coefficients --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
          &lt;!ATTLIST "scanComponentSpec" "acHuffTable" ("0" | "1" | "2" | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            "3") #REQUIRED&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
            &lt;!-- The huffman table to use for encoding AC coefficients --&gt; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
]&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
<h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
<a name=stream>Stream Metadata DTD</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
&lt;!DOCTYPE "javax_imageio_jpeg_stream_1.0" [
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
  &lt;!ELEMENT "javax_imageio_jpeg_stream_1.0" (dqt |
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
                      dht | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
                      dri | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
                      com | 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
                      unknown)*&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
   
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
  &lt;!-- All elements are as defined above for image metadata --&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
]&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
</html>