Path: blob/master/src/java.desktop/share/classes/javax/imageio/package-info.java
41152 views
/*1* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/**26* The main package of the Java Image I/O API.27* <p>28* Many common image I/O operations may be performed using the static methods of29* the {@code ImageIO} class.30* <p>31* This package contains the basic classes and interfaces for describing the32* contents of image files, including metadata and thumbnails33* ({@code IIOImage}); for controlling the image reading process34* ({@code ImageReader}, {@code ImageReadParam}, and {@code ImageTypeSpecifier})35* and image writing process ({@code ImageWriter} and {@code ImageWriteParam});36* for performing transcoding between formats ({@code ImageTranscoder}), and for37* reporting errors ({@code IIOException}).38* <p>39* All implementations of javax.imageio provide the following standard image40* format plug-ins:41*42* <table class="striped">43* <caption>Standard image format plug-ins</caption>44* <thead>45* <tr>46* <th scope="col">Image format47* <th scope="col">Reading48* <th scope="col">Writing49* <th scope="col">Notes50* <th scope="col">Metadata51* </thead>52* <tbody>53* <!-- BMP plugin -->54* <tr>55* <th scope="row">56* <a href="https://msdn.microsoft.com/en-us/library/dd183391.aspx">BMP</a>57* <td>yes58* <td>yes59* <td>none60* <td><a href='metadata/doc-files/bmp_metadata.html'>BMP61* metadata format</a>62* <!-- GIF plugin -->63* <tr>64* <th scope="row">65* <a href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">GIF</a>66* <td>yes67* <td>yes68* <td><a href="#gif_plugin_notes">GIF plug-in notes</a>69* <td><a href='metadata/doc-files/gif_metadata.html'>GIF70* metadata format</a>71* <!-- JPEG plugin -->72* <tr>73* <th scope="row"><a href="http://www.jpeg.org">JPEG</a>74* <td>yes75* <td>yes76* <td>none77* <td><a href='metadata/doc-files/jpeg_metadata.html'>78* JPEG metadata format</a>79* <!-- PNG plugin -->80* <tr>81* <th scope="row"><a href="http://www.libpng.org/pub/png/spec/">PNG</a>82* <td>yes83* <td>yes84* <td>none85* <td><a href='metadata/doc-files/png_metadata.html'>PNG86* metadata format</a>87* <!-- TIFF plugin -->88* <tr>89* <th scope="row">90* <a href="https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf">91* TIFF</a>92* <td>yes93* <td>yes94* <td>95* <a href='metadata/doc-files/tiff_metadata.html#Reading'>TIFF plug-in96* notes</a>97* <td>98* <a href='metadata/doc-files/tiff_metadata.html#StreamMetadata'>TIFF99* metadata format</a>100* <!-- WBMP plugin -->101* <tr>102* <th scope="row">103* <a href="http://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf">104* WBMP</a>105* <td>yes106* <td>yes107* <td>none108* <td><a href='metadata/doc-files/wbmp_metadata.html'>109* WBMP metadata format</a>110* </tbody>111* </table>112*113* <h2> Standard Plug-in Notes</h2>114*115* <h3><a id="gif_plugin_notes">Standard plug-in for GIF image format</a></h3>116* ImageIO provides {@code ImageReader} and {@code ImageWriter}plug-ins for the117* <a href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt"> Graphics118* Interchange Format (GIF)</a> image format. These are the "standard" GIF119* plug-ins, meaning those that are included in the JRE, as distinct from those120* included in standard extensions, or 3rd party plug-ins. The following notes121* and metadata specification apply to the standard plug-ins.122*123* <h3>Writing GIF images</h3>124* The GIF image writer plug-in guarantees lossless writing for images which125* meet the following requirements:126* <ul>127* <li>the number of bands is 1;</li>128* <li>the number of bits per sample is not greater than 8;</li>129* <li>the size of a color component is not greater than 8;</li>130* </ul>131* <p>132* By default the GIF writer plug-in creates version "89a" images. This can be133* changed to "87a" by explicitly setting the version in the stream metadata134* (see135* <a href="metadata/doc-files/gif_metadata.html#gif_stream_metadata_format">136* GIF Stream Metadata Format Specification</a>).137*138* <!-- animated images -->139* <p>140* The GIF writer plug-in supports the creation of animated GIF images through141* the standard sequence writing methods defined in the {@code ImageWriter}142* class.143*144* <!-- TODO: add example here -->145*146* <!-- color tables -->147* <p>148* A global color table is written to the output stream if one of the following149* conditions is met:150* <ul>151* <li>stream metadata containing a GlobalColorTable element is supplied;152* </li>153* <li>a sequence is being written and image metadata containing a154* LocalColorTable element is supplied for the first image in the sequence;155* </li>156* <li>image metadata is not supplied or does not contain a LocalColorTable157* element.</li>158* </ul>159* <p>160* In the first case the global color table in the stream metadata is used, in161* the second the local color table in the image metadata is used, and in the162* third a global color table is created from the ColorModel or SampleModel of163* the (first) image.164* <p>165* A local color table is written to the output stream only if image metadata166* containing a LocalColorTable element is supplied to the writer, or no image167* metadata is supplied to the writer and the local color table which would be168* generated from the image itself is not equal to the global color table.169* <p>170* A Graphic Control Extension block is written to the output stream only if171* image metadata containing a GraphicControlExtension element is supplied to172* the writer, or no image metadata is supplied and the local color table173* generated from the image requires a transparent index. Application, Plain174* Text, and Comment Extension blocks are written only if they are supplied to175* the writer via image metadata.176*177* <!-- writing interlaced images -->178* <p>179* The writing of interlaced images can be controlled by the progressive mode of180* the provided {@code ImageWriteParam} instance. If progressive mode is181* {@code MODE_DISABLED} then a non-interlaced image will be written. If182* progressive mode is {@code MODE_DEFAULT} then an interlaced image will be183* written. If progressive mode is {@code MODE_COPY_FROM_METADATA}, then the184* metadata setting is used (if it is provided, otherwise an interlaced image185* will be written).186* <p>187* The GIF image writer plug-in supports setting output stream metadata from188* metadata supplied to the writer in either the native GIF stream metadata189* format190* <a href="metadata/doc-files/gif_metadata.html#gif_stream_metadata_format">191* javax_imageio_gif_stream_1.0</a> or the standard metadata format192* <a href="metadata/doc-files/standard_metadata.html">javax_imageio_1.0</a>,193* and setting output image metadata from metadata supplied to the writer in194* either the native GIF image metadata format195* <a href="metadata/doc-files/gif_metadata.html#gif_image_metadata_format">196* javax_imageio_gif_image_1.0</a> or the standard metadata format197* <a href="metadata/doc-files/standard_metadata.html">javax_imageio_1.0</a>.198* The mapping of standard metadata format to the GIF native stream and image199* metadata formats is given in the tables200* <a href="metadata/doc-files/gif_metadata.html#mapping">here</a>.201*202* @since 1.4203*/204package javax.imageio;205206207