Java Advanced Imaging Image I/O Tools API core (standalone) 1.4.0 API

JavaTM Advanced Imaging Image I/O Tools provides JAI readand write operations which use theJavaImage I/O Framework, image input and output streams which use theNew I/O APIs, and image reader and writer plug-ins.

See: Description

Packages 
PackageDescription
com.github.jaiimageio.impl.common 
com.github.jaiimageio.impl.plugins.bmp 
com.github.jaiimageio.impl.plugins.clib 
com.github.jaiimageio.impl.plugins.gif 
com.github.jaiimageio.impl.plugins.jpeg 
com.github.jaiimageio.impl.plugins.pcx 
com.github.jaiimageio.impl.plugins.png 
com.github.jaiimageio.impl.plugins.pnm 
com.github.jaiimageio.impl.plugins.raw 
com.github.jaiimageio.impl.plugins.tiff 
com.github.jaiimageio.impl.plugins.wbmp 
com.github.jaiimageio.impl.stream 
com.github.jaiimageio.plugins.bmp
Package containing the public classes used by the Sun BMP plug-in forthe Image I/O Framework.
com.github.jaiimageio.plugins.pnm
Package containing the public classes used by the Sun PNM plug-in forthe Image I/O Framework.
com.github.jaiimageio.plugins.tiff
Package containing the public classes used by the TIFF plug-in forthe Image I/O Framework.
com.github.jaiimageio.stream
Provides ImageInputStream and ImageOutputStreamclasses for use with the Java Image I/O Framework.
JavaTM Advanced Imaging Image I/O Tools provides JAI readand write operations which use theJavaImage I/O Framework, image input and output streams which use theNew I/O APIs, and image reader and writer plug-ins.

JAI Image I/O Operations

JAI operations which read and write images using the Java Image I/O Frameworkare provided in the package com.sun.media.jai.operator.

Java Image I/O Streams

Image I/O stream classes based on the new java.nio I/O APIs,for use with the "raw" format image reader plug-in, and for readingdiscontiguous image data are provided in the packagecom.github.jaiimageio.stream.

Java Image I/O Reader and Writer Plug-ins

Several reader and writer plug-ins for use with the Java Image I/O Frameworkare provided. A summary of their optional capabilities and metadata supportis given in the following table where F denotes false,T indicates true, X signifies that the capability isirrelevant, and U is a variable which is true if and onlyif the image data are uncompressed. Capabilities not listed may be assumed torevert to the respective defaults for reading and writing.

Reader/Writer Plug-in Capability Summary
CapabilityBMPGIFJPEGJPEG 2000PCXPNGPNMRawTIFFWBMP
ImageReader.canReadRaster()TXFTFFTTFT
ImageReader.isRandomAccessEasy(int)UXFFFFTTUT
ImageReader.readerSupportsThumbnails()FFTFFFFFFF
ImageWriteParam.canWriteCompressed()TTTTFTFFTF
ImageWriteParam.canWriteProgressive()FTFTFTFFFF
ImageWriteParam.canWriteTiles()FFFTFFFTTF
ImageWriter.canInsertEmpty(int)FFFFFFFFTF
ImageWriter.canInsertImage(int)FFFFFFFFTF
ImageWriter.canReplacePixels(int)FFFFFFFFTF
ImageWriter.canWriteRasters()TFFTFFTTFT
ImageWriter.canWriteEmpty()FFFFFFFFTF
ImageWriter.canWriteSequence()FTFFFFFFTF
Stream MetadataFTFFFFFFTF
Standard Image MetadataTTT (reader only)TFTTFTT (reader only)
Native Image MetadataTTT (reader only)TFTTFTT (reader only)

BMP

ImageReader and ImageWriter plug-ins are providedfor the Bitmap (BMP) format. A summary of the attributes of these plug-ins isgiven in the following table with more details in the description of thepackage com.github.jaiimageio.plugins.bmp.

BMP Reader/Writer Plug-in Attributes
AttributeValue
Format Namebmp
MIME Typeimage/bmp
Suffixbmp
Native Image Metadatacom_sun_media_imageio_plugins_bmp_image_1.0
ImageWriteParamBMPImageWriteParam
ReferencesNo formal, well-defined specification exists but theBMP - Windows Bitmap Format FAQ Entry contains useful information

GIF

An ImageWriter plug-in is provided for the Graphics InterchangeFormat (GIF). Animated GIF images may be created using the standard sequencewriting methods defined in ImageWriter. By default thewriter creates version "89a" images.

The writer supports setting output stream metadata frommetadata supplied to the writer in either the native GIF stream metadata formatjavax_imageio_gif_stream_1.0 or the standard metadata formatjavax_imageio_1.0, and setting output image metadata from metadatasupplied to the writer in either the native GIF image metadata formatjavax_imageio_gif_image_1.0 or the standard metadata formatjavax_imageio_1.0. The mapping of standard metadata format tothe GIF native stream and image metadata formats is given in the tablesbelow.

A global color table is written to the output stream if one of the followingconditions obtains:

  • stream metadata containing a GlobalColorTable element are supplied;
  • a sequence is being written and image metadata containing aLocalColorTable element are supplied for the first image in the sequence;or
  • image metadata are not supplied or do not contain a LocalColorTableelement.
In the first case the global color table in the stream metadata is used, inthe second the local color table in the image metadata is used, and in thethird a global color table is created from the ColorModel or SampleModel ofthe (first) image.

A local color table is written to the output stream only if image metadatacontaining a LocalColorTable element are supplied to the writer, or no imagemetadata are supplied to the writer and the local color table which would begenerated from the image itself is not equal to the global color table.

A Graphic Control Extension block is written to the output stream only ifimage metadata containing a GraphicControlExtension element are supplied tothe writer, or no image metadata are supplied and the local color tablegenerated from the image requires a transparent index. Application, PlainText, and Comment Extension blocks are written only if they are supplied tothe writer via image metadata.

Mapping of Standard to GIF Native Stream Metadata
Standard Metadata ComponentGIF Native Stream Metadata Component
/Chroma/Palette/PaletteEntry@index/GlobalColorTable/ColorTableEntry@index
/Chroma/Palette/PaletteEntry@red/GlobalColorTable/ColorTableEntry@red
/Chroma/Palette/PaletteEntry@green/GlobalColorTable/ColorTableEntry@green
/Chroma/Palette/PaletteEntry@blue/GlobalColorTable/ColorTableEntry@blue
/Chroma/BackgroundIndex@value/GlobalColorTable@backgroundColorIndex
/Data/BitsPerSample@value/LogicalScreenDescriptor@colorResolution
/Dimension/PixelAspectRatio@value/LogicalScreenDescriptor@pixelAspectRatio
/Dimension/HorizontalScreenSize@value/LogicalScreenDescriptor@logicalScreenWidth
/Dimension/VerticalScreenSize@value/LogicalScreenDescriptor@logicalScreenHeight
/Document/FormatVersion@value/Version@value

Mapping of Standard to GIF Native Image Metadata
Standard Metadata ComponentGIF Native Image Metadata Component
/Chroma/Palette/PaletteEntry@index/LocalColorTable/ColorTableEntry@index
/Chroma/Palette/PaletteEntry@red/LocalColorTable/ColorTableEntry@red
/Chroma/Palette/PaletteEntry@green/LocalColorTable/ColorTableEntry@green
/Chroma/Palette/PaletteEntry@blue/LocalColorTable/ColorTableEntry@blue
/Compression/NumProgressiveScans@value/ImageDescriptor@interlaceFlag
/Dimension/HorizontalPixelOffset@value/ImageDescriptor@imageLeftPosition
/Dimension/VerticalPixelOffset@value/ImageDescriptor@imageTopPosition
/Text/TextEntry@value/CommentExtensions/CommentExtension@value
/Transparency/TransparentIndex@value/GraphicControlExtension@transparentColorIndex(/GraphicControlExtension@transparentColorFlag is also set to"TRUE")

GIF Writer Plug-in Attributes
AttributeValue
Format Namegif
MIME Typeimage/gif
Suffixgif
ImageWriteParamImageWriteParam subclass
ReferencesGIF 87a Specification (W3C page)

GIF ImageWriteParam Subclass Attributes
AttributeValue
Compression Types"LZW"
Compression ModesImageWriteParam.MODE_DEFAULT,ImageWriteParam.MODE_EXPLICIT
Progressive ModesImageWriteParam.MODE_COPY_FROM_METADATA (use metadatasetting if provided, otherwise interlaced),ImageWriteParam.MODE_DEFAULT (interlaced),ImageWriteParam.MODE_DISABLED (not interlaced)
(MODE_COPY_FROM_METADATA is initial setting)

JPEG

ImageReader and ImageWriter plug-ins are providedfor the JPEG image format. These plug-ins are accelerated using native code.If security permission settings disallow loading native code, or if thesystem property "com.github.jaiimageio.disableCodecLib" is set to "true"at the time of plug-in registration the service provider will deregisteritself and the plug-ins will not be available.

In addition to providing better performance through native accelerationfor conventional (lossy) JPEG (baseline sequential DCT, 8-bit sampleprecision), these plug-ins also support the following additional JPEG codingprocesses from ISO-10918-1/ITU-T.81:

  • extended sequential DCT, Huffman coding, 12-bit sample precision(compressionType set to "JPEG")
  • lossless Huffman coding, 2- through 16-bit sample precision(compressionType set to "JPEG-LOSSLESS")
as well as the following JPEG coding process from ISO-14495-1/ITU-T.87:
  • near-lossless (encoder only) and lossless (encoder and decoder) contextmodeling with adaptive Golomb-type coding, 2- through 16-bit sample precision(compressionType set to "JPEG-LS")

All subsampling and sub-banding is performed in memory, however, so ifeither is required, use of the core JPEG plug-in might be preferable. Thisplug-in performs best when the data are pixel interleaved with pixel strideequal to the number of samples per pixel and color component order G(grayscale), GA (grayscale with alpha), RGB (red-green-blue),BGR (blue-green-red), RGBA (red-green-blue with alpha), or CMYK(cyan-magenta-yellow-black) as appropriate for the color space. Other layoutswill cause data to be reformatted in memory.

If the JPEG reader detects an ICC profile in an APP2 marker segment itwill use it to define the raw ImageTypeSpecifier.If the inferred color space not based on the ICC profile is compatiblewith the ICC profile-based color space, then a secondImageTypeSpecifier derived from this inferred colorspace will be included in the Iterator returned byImageReader.getImageTypes(int). If the iterator containsmore than one type, the first one will be based on the ICC profile and thesecond on the inferred color space.

The JPEG reader supports TIFF native image metadata as an extra metadataformat. If the JPEG stream contains an EXIF APP1 marker segment, the primaryIFD contained therein will be available from the metadata tree extractedusing the TIFF extra metadata format name. The IIOMetadataobject returned by the JPEG reader may also be used in a call toTIFFDirectory.createFromMetadata() to create a TIFFDirectoryinstance from which TIFFFields may be easily extracted.

The JPEG reader supports thumbnails. These may be derived from JFIF APP0,JFXX APP0, or EXIF APP1 marker segments. Although APP0 marker segments arenot allowed by the EXIF specification, there nevertheless exist EXIF imageswhich contain them. If there is more than one thumbnail present, the JFIFthumbnail will be retrieved first, followed by any JFXX thumbnail(s), followedby any EXIF thumbnail. The source of each respective thumbnail may bedetermined by consulting the native image metadata.

The baseline DCT JPEG writer encodes images with from 1 to 4 bands. Ifthe image is 4-banded with a ColorSpace of typeColorSpace.TYPE_CMYK, an AdobeAPP14 marker with transform parameter value 0 will be written and the imagecomponents will not be subsampled.

JPEG Reader/Writer Plug-in Attributes
AttributeValue
Format Namesjpeg, jpg, jpeg-lossless (ISO 10918-1 lossless),jpeg-ls (ISO 14495-1 lossless), jfif
MIME Typeimage/jpeg
Suffixesjpeg, jpg, jls (ISO 14495-1 lossless), jfif
Native Image Metadatajavax_imageio_jpeg_1.0
Extra Image Metadatacom_sun_media_imageio_plugins_tiff_image_1.0
ImageWriteParamImageWriteParam subclass
ReferencesJPEG Home Page

JPEG ImageWriteParam Subclass Attributes
AttributeValue
Compression Types"JPEG" (conventional, lossy JPEG),"JPEG-LOSSLESS" (ISO-10918-1 lossless),"JPEG-LS" (ISO-14495-1 lossless)
Compression ModesImageWriteParam.MODE_DEFAULT (lossy),ImageWriteParam.MODE_EXPLICIT
ImageWriteParam.isCompressionLossless()true if and only if compressionType isnot "JPEG"

JPEG 2000

See JPEG 2000 javadoc

PCX

ImageReader and ImageWriter plug-ins are providedfor the PCX image format. A summary of the attributes of these plug-ins isgiven in the following table.

PCX Reader/Writer Plug-in Attributes
AttributeValue
Format Namepcx
MIME Typesimage/pcx, image/x-pcx, image/x-windows-pcx, image/x-pc-paintbrush
Suffixespcx
ReferencesPCX Summary from the Encyclopedia of Graphics File Formats

PNG

ImageReader and ImageWriter plug-ins are providedfor the Portable Network Graphics (PNG) image format. These plug-ins areaccelerated using native code.If security permission settings disallow loading native code, or if thesystem property "com.github.jaiimageio.disableCodecLib" is set to "true"at the time of plug-in registration the service provider will deregisteritself and the plug-ins will not be available.

In addition to providing better performance through native acceleration,these plug-ins also provide the ability to set the compression level andencoder strategy. All subsampling and sub-banding is performed in memory,however, so if either of these is required, use of the core PNG plug-inmight be preferable. This plug-in performs best when the data are eitherpacked bilevel (1 sample per pixel, 1 bit per sample) or pixelinterleaved with pixel stride equal to the number of samples per pixel andcolor component order G (grayscale), GA (grayscale with alpha), RGB(red-green-blue), or RGBA (red-green-blue with alpha) as appropriate for thecolor space. Other layouts will cause data to be reformatted in memory.Currently only bit depths of 1, 8, and 16 are supported.

If the PNG reader detects an ICC profile in an iCCP chunk itwill use it to define the raw ImageTypeSpecifier.If the inferred color space not based on the ICC profile field is compatiblewith the ICC profile-based color space, then a secondImageTypeSpecifier derived from this inferred colorspace will be included in the Iterator returned byImageReader.getImageTypes(int). If the iterator containsmore than one type, the first one will be based on the ICC profile and thesecond on the inferred color space.

The PNG writer will write an iCCP chunk to the output if one is in thenative image metadata object provided to the writer, or if theColorSpace of the ColorModel of the destinationImageTypeSpecifier is based on an ICC profile which is not oneof the standard ColorSpaces corresponding to theColorSpace.cs_* constants. The destination type is set viaImageWriteParam.setDestinationType() and defaults to theImageTypeSpecifier of the image being written.

PNG Reader/Writer Plug-in Attributes
AttributeValue
Format Namepng
MIME Typeimage/png
Suffixpng
Native Image Metadatajavax_imageio_png_1.0
ImageWriteParamImageWriteParam subclass
ReferencesW3C PNG Page

PNG ImageWriteParam Subclass Attributes
AttributeValue
Compression Types"DEFAULT", "FILTERED", "HUFFMAN_ONLY"
Compression ModesImageWriteParam.MODE_DEFAULT,ImageWriteParam.MODE_EXPLICIT,ImageWriteParam.MODE_COPY_FROM_METADATA (initial setting).
Compression QualitySets compression level ascompressionLevel = (int)(9*(1.0F - compressionQuality))
Progressive ModesImageWriteParam.MODE_DEFAULT ("Adam7" interlacing),ImageWriteParam.MODE_DISABLED (no interlacing),ImageWriteParam.MODE_COPY_FROM_METADATA (initial setting).

Mapping Between Standard and Native PNG Image Metadata
Standard Metadata ComponentPNG Native Image Metadata Component
/Chroma/ColorSpaceType@name/IHDR@colorType
/Chroma/NumChannels@value/IHDR@colorType, /tRNS
/Chroma/Gamma@value/gAMA@gamma
/Chroma/BlackIsZero@valueAlways "TRUE"
/Chroma/Palette/PLTE
/Chroma/Palette/PaletteEntry@red/PLTE/PLTEEntry@red
/Chroma/Palette/PaletteEntry@green/PLTE/PLTEEntry@green
/Chroma/Palette/PaletteEntry@blue/PLTE/PLTEEntry@blue
/Chroma/Palette/PaletteEntry@alpha/PLTE/PLTEEntry@alpha
/Chroma/BackgroundIndex@value/bKGD/bKGD_Palette@index
/Chroma/BackgroundColor@red/bKGD/bKGD_RGB@red or /bKGD/bKGD_Grayscale@gray
/Chroma/BackgroundColor@green/bKGD/bKGD_RGB@green or /bKGD/bKGD_Grayscale@gray
/Chroma/BackgroundColor@blue/bKGD/bKGD_RGB@blue or /bKGD/bKGD_Grayscale@gray
/Compression/CompressionTypeName@valueAlways "deflate"
/Compression/Lossless@valueAlways "TRUE"
/Compression/NumProgressiveScans@value/IHDR/interlaceMethod@value
/Data/PlanarConfiguration@valueAlways "PixelInterleaved"
/Data/SampleFormat@value/IHDR@colorType
/Data/BitsPerSample@value/IHDR@bitDepth, /IHDR@colorType, /tRNS
/Data/SignificantBitsPerSample@value/sBIT
/Dimension/PixelAspectRatio@value/pHYs@pixelsPerUnitYAxis//pHYs@pixelsPerUnitXAxis or 1.0
/Dimension/ImageOrientation@valueAlways "Normal"
/Dimension/HorizontalPixelSize@value/pHYs@pixelsPerUnitXAxis, /pHYS@unitSpecifier
/Dimension/VerticalPixelSize@value/pHYs@pixelsPerUnitYAxis, /pHYS@unitSpecifier
/Document/ImageModificationTime@value/tIME
/Text/TextEntry/tEXt, /iTXt, /zTXt
/Transparency/Alpha@value/IHDR@colorType, /tRNS@alpha
/Transparency/TransparentColor@value/tRNS

PNM

ImageReader and ImageWriter plug-ins are providedfor the "portable anymap" (PNM) image format which refers collectively to theformats PBM (portable bitmap), PGM (portable graymap), and PPM (portablepixmap). A summary of the attributes of these plug-ins is given in thefollowing table with more details in the description of the packagecom.github.jaiimageio.plugins.pnm.

PNM Reader/Writer Plug-in Attributes
AttributeValue
Format Namepnm
MIME Typesimage/x-portable-anymap, image/x-portable-bitmapimage/x-portable-graymap,image/x-portable-pixmap
Suffixespbm, pgm, ppm
Native Image Metadatacom_sun_media_imageio_plugins_pnm_image_1.0
ImageWriteParamPNMImageWriteParam
ReferencesThe Netpbm Formats,
Manpage of pbm,
Manpage of pgm,
Manpage of ppm

Raw

ImageReader and ImageWriter plug-ins are providedfor the "raw" image format. The ImageReader plug-in for the"raw" format requires an input which is aRawImageInputStream.

The reader plug-in reads any uncompressed data defined by ComponentSampleModel,SinglePixelPackedSampleModel or MultiPixelPackedSampleModel as viewed via the ImageInputStream. For example, if extra data are prepended orappended to image lines,SegmentedImageInputStream may be usedto define the location of the image data for each line. Thus, if thedata viewed from RawImageInputStream are defined by theSampleModels above after RawImageInputStream is chained with SegmentedImageInputStream, the reader plug-in can decode these data correctly.

The writer plug-in writes the data to the stream exactly as defined bythe SampleModel. If the SampleModel has ascanline stride associated with it, this will be used to determine the lengthof each line written. If only the actual image data and not any prefix orsuffix data on the line are to be written and the scanline stride is greaterthan the SampleModel width multiplied by the number of bands, the image should first be reformatted to remove the extra data. If JAI is available the "Format" operation may be used for reformatting the data.

Raw Reader/Writer Plug-in Attributes
AttributeValue
Format Nameraw
MIME Typenone
Suffixnone
ImageWriteParamImageWriteParam subclass
ReferencesXML InputSource defined atRawImageInputStream.RawImageInputStream(javax.imageio.stream.ImageInputStream,org.xml.sax.InputSource)

Raw ImageWriteParam Subclass Attributes
AttributeValue
Tiling ModesImageWriteParam.MODE_DEFAULT

TIFF

ImageReader and ImageWriter plug-ins are providedfor the Tag(ged) Image File Format (TIFF). A summary of the attributes of theseplug-ins is given in the table below with more details in the descriptionof the package com.github.jaiimageio.plugins.tiff. Native codeis used to accelerate bilevel encodings. If security permission settingsdisallow loading native code, or if the system property"com.github.jaiimageio.disableCodecLib" is set to "true" at the time of(de)compression, native acceleration will not be used.

TIFF Reader/Writer Plug-in Attributes
AttributeValue
Format Namestif, tiff
MIME Typeimage/tiff
Suffixestif, tiff
Native Stream Metadatacom_sun_media_imageio_plugins_tiff_stream_1.0
Native Image Metadatacom_sun_media_imageio_plugins_tiff_image_1.0
ImageReadParamTIFFImageReadParam
ImageWriteParamTIFFImageWriteParam
ReferencesTIFF 6.0 Specification (PDF),
TIFF Specification Supplement 1 (PDF),
TIFF Specification Supplement 2 (PDF) (covers ZLIB and JPEGcompression in TIFF),
The Unofficial TIFF Home Page,
TIFF Software (libtiff),
TIFF-F Revised Specification,
JPEG-in-TIFF compression,
DEFLATE specification (Zip-in-TIFF),
ZLIB specification (Zip-in-TIFF),
ICC Specification (PDF):section B.4: Embedding ICC profiles in TIFF files,
EXIF and related resources

WBMP

ImageReader and ImageWriter plug-ins are providedfor the Wireless Bitmap (WBMP) image format. A summary of the attributes ofthese plug-ins is given in the following table.

WBMP Reader/Writer Plug-in Attributes
AttributeValue
Format Namewbmp
MIME Typeimage/vnd.wap.wbmp
Suffixwbmp
Native Image Metadatacom_sun_media_imageio_plugins_wbmp_image_1.0
ReferencesWAP Media Types Specification (PDF) available fromWAP Forum Specifications andOpen Mobile Alliance

Image Metadata

The XML schema for the WBMP native image metadata format is as follows:
<?xml version="1.0" encoding="UTF-8"?><!-- Schema for WBMP native image metadata format. --><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"            xmlns="http://com.github.jaiimageio.plugins"            targetNamespace="http://com.github.jaiimageio.plugins">  <!-- WBMP Schema 1.0 root element. -->  <xsd:element name="com_sun_media_imageio_plugins_wbmp_image_1.0">    <xsd:complexType>      <xsd:sequence>        <!-- WBMP type -->        <xsd:element name="WBMPType" type="xsd:unsignedInt"/>        <!-- Bitmap width -->        <xsd:element name="Width" type="xsd:unsignedInt"/>        <!-- Bitmap height -->        <xsd:element name="Height" type="xsd:unsignedInt"/>      </xsd:sequence>    </xsd:complexType>  </xsd:element> <!-- wbmp_image_1.0 --></xsd:schema>

Since:
1.0

Copyright © 2018 jai-imageio GitHub group. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14