ImageWriter.
A plug-in for a specific image format may define a subclass of
this class, and return objects of that class from the
getDefaultWriteParam method of its
ImageWriter implementation. For example, the built-in
JPEG writer plug-in will return instances of
javax.imageio.plugins.jpeg.JPEGImageWriteParam.
The region of the image to be written is determined by first
intersecting the actual bounds of the image with the rectangle
specified by IIOParam.setSourceRegion, if any. If the
resulting rectangle has a width or height of zero, the writer will
throw an IIOException. If the intersection is
non-empty, writing will commence with the first subsampled pixel
and include additional pixels within the intersected bounds
according to the horizontal and vertical subsampling factors
specified by IIOParam..
Individual features such as tiling, progressive encoding, and
compression may be set in one of four modes.
MODE_DISABLED disables the features;
MODE_DEFAULT enables the feature with
writer-controlled parameter values; MODE_EXPLICIT
enables the feature and allows the use of a set method
to provide additional parameters; and
MODE_COPY_FROM_METADATA copies relevant parameter
values from the stream and image metadata objects passed to the
writer. The default for all features is
MODE_COPY_FROM_METADATA. Non-standard features
supplied in subclasses are encouraged, but not required to use a
similar scheme.
Plug-in writers may extend the functionality of
ImageWriteParam by providing a subclass that implements
additional, plug-in specific interfaces. It is up to the plug-in
to document what interfaces are available and how they are to be
used. Writers will silently ignore any extended features of an
ImageWriteParam subclass of which they are not aware.
Also, they may ignore any optional features that they normally
disable when creating their own ImageWriteParam
instances via getDefaultWriteParam.
Note that unless a query method exists for a capability, it must
be supported by all ImageWriter implementations
(e.g. progressive encoding is optional, but subsampling must be
supported).
ImageReadParam
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | canOffsetTiles
A |
| protected boolean | canWriteCompressed
A |
| protected boolean | canWriteProgressive
A |
| protected boolean | canWriteTiles
A |
| protected int | compressionMode
The mode controlling compression settings, which must be set to
one of the four |
| protected float | compressionQuality
A |
| protected String | compressionType
A |
| protected String[] | compressionTypes
An array of |
| protected Locale | locale
A |
| private static final int | |
| public static final int | MODE_COPY_FROM_METADATA
A constant value that may be passed into methods such as
|
| public static final int | MODE_DEFAULT
A constant value that may be passed into methods such as
|
| public static final int | MODE_DISABLED
A constant value that may be passed into methods such as
|
| public static final int | MODE_EXPLICIT
A constant value that may be passed into methods such as
|
| protected Dimension[] | preferredTileSizes
An array of preferred tile size range pairs. |
| protected int | progressiveMode
The mode controlling progressive encoding, which must be set to
one of the four |
| protected int | tileGridXOffset
The amount by which the tile grid origin should be offset horizontally from the image origin if tiling has been set, or 0 otherwise. |
| protected int | tileGridYOffset
The amount by which the tile grid origin should be offset vertically from the image origin if tiling has been set, or 0 otherwise. |
| protected int | tileHeight
The height of each tile if tiling has been set, or 0 otherwise. |
| protected int | tileWidth
The width of each tile if tiling has been set, or 0 otherwise. |
| protected int | tilingMode
The mode controlling tiling settings, which Must be
set to one of the four |
| protected boolean | tilingSet
A |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | ImageWriteParam(Locale
a locale)Locale to be used to localize
compression type names and quality descriptions, or
null.Constructs an |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the writer supports non-zero tile
offsets.Returns |
| public boolean | Returns: true if the writer supports compression.Returns |
| public boolean | Returns: true if the writer supports progressive
encoding.Returns |
| public boolean | Returns: true if the writer supports tiling.Returns |
| private static Dimension[] | |
| public float | Returns: an estimate of the compressed bit rate, or-1.0F if no estimate is available.the quality setting whose bit rate is to be
queried. quality)Returns a |
| public int | Returns: the current compression mode.Returns the current compression mode, if compression is supported. |
| public float | Returns: the current compression quality setting.Returns the current compression quality setting. |
| public String[] | Returns: an array ofStrings containing localized
descriptions of the compression quality levels.Returns an array of |
| public float[] | Returns: an array offloats indicating the
boundaries between the compression quality levels as described
by the Strings from
getCompressionQualityDescriptions.Returns an array of |
| public String | Returns: the current compression type as aString,
or null if no type is set.Returns the currently set compression type, or
|
| public String[] | Returns: an array ofStrings containing the
(non-localized) names of available compression types, or
null.Returns a list of available compression types, as an array or
|
| public Locale | Returns: the currentLocale, or null.Returns the currently set |
| public String | Returns: aString containing a localized version of
the name of the current compression type.Returns a localized version of the name of the current
compression type, using the |
| public Dimension[] | Returns: an array ofDimensions with an even length
of at least two, or null.Returns an array of |
| public int | Returns: the current mode for progressive encoding.Returns the current mode for writing the stream in a progressive manner. |
| public int | Returns: the tile grid X offset to be used for encoding.Returns the horizontal tile grid offset of an image as it will be written to the output stream. |
| public int | Returns: the tile grid Y offset to be used for encoding.Returns the vertical tile grid offset of an image as it will be written to the output stream. |
| public int | Returns: the tile height to be used for encoding.Returns the height of each tile in an image as it will be written to the output stream. |
| public int | Returns: the tile width to be used for encoding.Returns the width of each tile in an image as it will be written to the output stream. |
| public int | Returns: the current tiling mode.Returns the current tiling mode, if tiling is supported. |
| public boolean | Returns: true if the current compression type is
lossless.Returns |
| public void | setCompressionMode(int
The mode for setting compression in the output
stream. mode)Specifies whether compression is to be performed, and if so how compression parameters are to be determined. |
| public void | setCompressionQuality(float
a quality)float between 0 and
1 indicating the desired quality level.Sets the compression quality to a value between |
| public void | setCompressionType(String
one of the compressionType)Strings returned
by getCompressionTypes, or null to
remove any previous setting.Sets the compression type to one of the values indicated by
|
| public void | setProgressiveMode(int
The mode for setting progression in the output
stream. mode)Specifies that the writer is to write the image out in a progressive mode such that the stream will contain a series of scans of increasing quality. |
| public void | setTiling(int
the width of each tile. tileWidth, int the height of each tile. tileHeight, int the horizontal offset of the tile grid. tileGridXOffset, int the vertical offset of the tile grid. tileGridYOffset)Specifies that the image should be tiled in the output stream. |
| public void | setTilingMode(int
The mode to use for tiling. mode)Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined. |
| public void | |
| public void |
| canOffsetTiles | back to summary |
|---|---|
| protected boolean canOffsetTiles A Subclasses that do not support writing tiles, or that
support writing but not offsetting tiles must ensure that this
value is set to | |
| canWriteCompressed | back to summary |
|---|---|
| protected boolean canWriteCompressed A Subclasses that do not support compression must ensure that
this value is set to | |
| canWriteProgressive | back to summary |
|---|---|
| protected boolean canWriteProgressive A Subclasses that do not support progressive encoding must
ensure that this value is set to | |
| canWriteTiles | back to summary |
|---|---|
| protected boolean canWriteTiles A Subclasses that do not support writing tiles should ensure
that this value is set to | |
| compressionMode | back to summary |
|---|---|
| protected int compressionMode The mode controlling compression settings, which must be set to
one of the four Subclasses that do not support compression may ignore this value. | |
| compressionQuality | back to summary |
|---|---|
| protected float compressionQuality A Subclasses that do not support compression may ignore this value. | |
| compressionType | back to summary |
|---|---|
| protected String compressionType A Subclasses that do not support compression may ignore this value. | |
| compressionTypes | back to summary |
|---|---|
| protected String[] compressionTypes An array of Subclasses that do not support compression may ignore this value. | |
| locale | back to summary |
|---|---|
| protected Locale locale A | |
| MAX_MODE | back to summary |
|---|---|
| private static final int MAX_MODE | |
| MODE_COPY_FROM_METADATA | back to summary |
|---|---|
| public static final int MODE_COPY_FROM_METADATA A constant value that may be passed into methods such as
This is the default mode for all features, so that a read including metadata followed by a write including metadata will preserve as much information as possible. | |
| MODE_DEFAULT | back to summary |
|---|---|
| public static final int MODE_DEFAULT A constant value that may be passed into methods such as
| |
| MODE_DISABLED | back to summary |
|---|---|
| public static final int MODE_DISABLED A constant value that may be passed into methods such as
| |
| MODE_EXPLICIT | back to summary |
|---|---|
| public static final int MODE_EXPLICIT A constant value that may be passed into methods such as
| |
| preferredTileSizes | back to summary |
|---|---|
| protected Dimension[] preferredTileSizes An array of preferred tile size range pairs. The default value
is Subclasses that do not support writing tiles may ignore this value.
| |
| progressiveMode | back to summary |
|---|---|
| protected int progressiveMode The mode controlling progressive encoding, which must be set to
one of the four Subclasses that do not support progressive encoding may ignore this value. | |
| tileGridXOffset | back to summary |
|---|---|
| protected int tileGridXOffset The amount by which the tile grid origin should be offset
horizontally from the image origin if tiling has been set,
or 0 otherwise. The initial value is Subclasses that do not support offsetting tiles may ignore this value. | |
| tileGridYOffset | back to summary |
|---|---|
| protected int tileGridYOffset The amount by which the tile grid origin should be offset
vertically from the image origin if tiling has been set,
or 0 otherwise. The initial value is Subclasses that do not support offsetting tiles may ignore this value. | |
| tileHeight | back to summary |
|---|---|
| protected int tileHeight The height of each tile if tiling has been set, or 0 otherwise.
The initial value is Subclasses that do not support tiling may ignore this value. | |
| tileWidth | back to summary |
|---|---|
| protected int tileWidth The width of each tile if tiling has been set, or 0 otherwise. Subclasses that do not support tiling may ignore this value. | |
| tilingMode | back to summary |
|---|---|
| protected int tilingMode The mode controlling tiling settings, which Must be
set to one of the four Subclasses that do not writing tiles may ignore this value. | |
| tilingSet | back to summary |
|---|---|
| protected boolean tilingSet A Subclasses that do not support writing tiles may ignore this value. | |
| ImageWriteParam | back to summary |
|---|---|
| protected ImageWriteParam() Constructs an empty | |
| ImageWriteParam | back to summary |
|---|---|
| public ImageWriteParam(Locale locale) Constructs an
| |
| canOffsetTiles | back to summary |
|---|---|
| public boolean canOffsetTiles() Returns
| |
| canWriteCompressed | back to summary |
|---|---|
| public boolean canWriteCompressed() Returns
| |
| canWriteProgressive | back to summary |
|---|---|
| public boolean canWriteProgressive() Returns
| |
| canWriteTiles | back to summary |
|---|---|
| public boolean canWriteTiles() Returns
| |
| clonePreferredTileSizes | back to summary |
|---|---|
| private static Dimension[] clonePreferredTileSizes(Dimension[] sizes) | |
| getBitRate | back to summary |
|---|---|
| public float getBitRate(float quality) Returns a If there are multiple compression types but none has been set,
an The default implementation checks that compression is
supported and the compression mode is
| |
| getCompressionMode | back to summary |
|---|---|
| public int getCompressionMode() Returns the current compression mode, if compression is supported.
| |
| getCompressionQuality | back to summary |
|---|---|
| public float getCompressionQuality() Returns the current compression quality setting. If there are multiple compression types but none has been
set, an The default implementation checks that compression is
supported and that the compression mode is
| |
| getCompressionQualityDescriptions | back to summary |
|---|---|
| public String[] getCompressionQualityDescriptions() Returns an array of As an example, the strings "Good", "Better", and "Best"
could be associated with the ranges If no descriptions are available, The descriptions should be localized for the
If there are multiple compression types but none has been set,
an The default implementation checks that compression is
supported and that the compression mode is
| |
| getCompressionQualityValues | back to summary |
|---|---|
| public float[] getCompressionQualityValues() Returns an array of If no descriptions are available, If there are multiple compression types but none has been set,
an The default implementation checks that compression is
supported and that the compression mode is
| |
| getCompressionType | back to summary |
|---|---|
| public String getCompressionType() Returns the currently set compression type, or
The default implementation checks whether compression is
supported and the compression mode is
| |
| getCompressionTypes | back to summary |
|---|---|
| public String[] getCompressionTypes() Returns a list of available compression types, as an array or
If the writer only offers a single, mandatory form of compression, it is not necessary to provide any named compression types. Named compression types should only be used where the user is able to make a meaningful choice between different schemes. The default implementation checks if compression is
supported and throws an
| |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() Returns the currently set
| |
| getLocalizedCompressionTypeName | back to summary |
|---|---|
| public String getLocalizedCompressionTypeName() Returns a localized version of the name of the current
compression type, using the The default implementation checks whether compression is
supported and the compression mode is
| |
| getPreferredTileSizes | back to summary |
|---|---|
| public Dimension[] getPreferredTileSizes() Returns an array of The information is returned as a set of pairs; the first
element of a pair contains an (inclusive) minimum width and
height, and the second element contains an (inclusive) maximum
width and height. Together, each pair defines a valid range of
sizes. To specify a fixed size, use the same width and height
for both elements. To specify an arbitrary range, a value of
If no array is specified on the constructor, but tiling is
allowed, then this method returns
| |
| getProgressiveMode | back to summary |
|---|---|
| public int getProgressiveMode() Returns the current mode for writing the stream in a progressive manner.
| |
| getTileGridXOffset | back to summary |
|---|---|
| public int getTileGridXOffset() Returns the horizontal tile grid offset of an image as it will
be written to the output stream. If tiling parameters have not
been set, an
| |
| getTileGridYOffset | back to summary |
|---|---|
| public int getTileGridYOffset() Returns the vertical tile grid offset of an image as it will
be written to the output stream. If tiling parameters have not
been set, an
| |
| getTileHeight | back to summary |
|---|---|
| public int getTileHeight() Returns the height of each tile in an image as it will be written to
the output stream. If tiling parameters have not
been set, an
| |
| getTileWidth | back to summary |
|---|---|
| public int getTileWidth() Returns the width of each tile in an image as it will be
written to the output stream. If tiling parameters have not
been set, an
| |
| getTilingMode | back to summary |
|---|---|
| public int getTilingMode() Returns the current tiling mode, if tiling is supported.
Otherwise throws an
| |
| isCompressionLossless | back to summary |
|---|---|
| public boolean isCompressionLossless() Returns If there are multiple compression types but none has
been set, an The default implementation checks whether compression is
supported and the compression mode is
| |
| setCompressionMode | back to summary |
|---|---|
| public void setCompressionMode(int mode) Specifies whether compression is to be performed, and if so how
compression parameters are to be determined. The
The default is
| |
| setCompressionQuality | back to summary |
|---|---|
| public void setCompressionQuality(float quality) Sets the compression quality to a value between A compression quality setting of 0.0 is most generically interpreted as "high compression is important," while a setting of 1.0 is most generically interpreted as "high image quality is important." If there are multiple compression types but none has been
set, an The default implementation checks that compression is
supported, and that the compression mode is
| |
| setCompressionType | back to summary |
|---|---|
| public void setCompressionType(String compressionType) Sets the compression type to one of the values indicated by
The default implementation checks whether compression is
supported and the compression mode is
| |
| setProgressiveMode | back to summary |
|---|---|
| public void setProgressiveMode(int mode) Specifies that the writer is to write the image out in a
progressive mode such that the stream will contain a series of
scans of increasing quality. If progressive encoding is not
supported, an The mode argument determines how
the progression parameters are chosen, and must be either
The modes are interpreted as follows:
The default is
| |
| setTiling | back to summary |
|---|---|
| public void setTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset) Specifies that the image should be tiled in the output stream.
The If
| |
| setTilingMode | back to summary |
|---|---|
| public void setTilingMode(int mode) Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined. The modes are interpreted as follows:
| |
| unsetCompression | back to summary |
|---|---|
| public void unsetCompression() Removes any previous compression type and quality settings. The default implementation sets the instance variable
| |
| unsetTiling | back to summary |
|---|---|
| public void unsetTiling() Removes any previous tile grid parameters specified by calls to
The default implementation sets the instance variables
| |