javax.imageio
Class ImageWriteParam

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam 
      extended by javax.imageio.ImageWriteParam
Direct Known Subclasses:
BMPImageWriteParam sample code for javax.imageio.plugins.bmp.BMPImageWriteParam definition code for javax.imageio.plugins.bmp.BMPImageWriteParam , JPEGImageWriteParam sample code for javax.imageio.plugins.jpeg.JPEGImageWriteParam definition code for javax.imageio.plugins.jpeg.JPEGImageWriteParam

public class ImageWriteParam
extends IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam

A class describing how a stream is to be encoded. Instances of this class or its subclasses are used to supply prescriptive "how-to" information to instances of 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.setSourceSubsampling sample code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) definition code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) .

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).

See Also:
ImageReadParam sample code for javax.imageio.ImageReadParam definition code for javax.imageio.ImageReadParam

Field Summary
protected  boolean canOffsetTiles sample code for javax.imageio.ImageWriteParam.canOffsetTiles definition code for javax.imageio.ImageWriteParam.canOffsetTiles
          A boolean that is true if this ImageWriteParam allows tiling grid offset parameters to be set.
protected  boolean canWriteCompressed sample code for javax.imageio.ImageWriteParam.canWriteCompressed definition code for javax.imageio.ImageWriteParam.canWriteCompressed
          A boolean that is true if this writer can write images using compression.
protected  boolean canWriteProgressive sample code for javax.imageio.ImageWriteParam.canWriteProgressive definition code for javax.imageio.ImageWriteParam.canWriteProgressive
          A boolean that is true if this ImageWriteParam allows images to be written as a progressive sequence of increasing quality passes.
protected  boolean canWriteTiles sample code for javax.imageio.ImageWriteParam.canWriteTiles definition code for javax.imageio.ImageWriteParam.canWriteTiles
          A boolean that is true if this ImageWriteParam allows tile width and tile height parameters to be set.
protected  int compressionMode sample code for javax.imageio.ImageWriteParam.compressionMode definition code for javax.imageio.ImageWriteParam.compressionMode
          The mode controlling compression settings, which must be set to one of the four MODE_* values.
protected  float compressionQuality sample code for javax.imageio.ImageWriteParam.compressionQuality definition code for javax.imageio.ImageWriteParam.compressionQuality
          A float containing the current compression quality setting.
protected  String sample code for java.lang.String definition code for java.lang.String compressionType sample code for javax.imageio.ImageWriteParam.compressionType definition code for javax.imageio.ImageWriteParam.compressionType
          A String containing the name of the current compression type, or null if none is set.
protected  String sample code for java.lang.String definition code for java.lang.String [] compressionTypes sample code for javax.imageio.ImageWriteParam.compressionTypes definition code for javax.imageio.ImageWriteParam.compressionTypes
          An array of Strings containing the names of the available compression types.
protected  Locale sample code for java.util.Locale definition code for java.util.Locale locale sample code for javax.imageio.ImageWriteParam.locale definition code for javax.imageio.ImageWriteParam.locale
          A Locale to be used to localize compression type names and quality descriptions, or null to use a default Locale.
static int MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA
          A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, or setCompressionMode to enable that feature for future writes.
static int MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT
          A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to enable that feature for future writes.
static int MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED
          A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to disable a feature for future writes.
static int MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT
          A constant value that may be passed into methods such as setTilingMode or setCompressionMode to enable a feature for future writes.
protected  Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension [] preferredTileSizes sample code for javax.imageio.ImageWriteParam.preferredTileSizes definition code for javax.imageio.ImageWriteParam.preferredTileSizes
          An array of preferred tile size range pairs.
protected  int progressiveMode sample code for javax.imageio.ImageWriteParam.progressiveMode definition code for javax.imageio.ImageWriteParam.progressiveMode
          The mode controlling progressive encoding, which must be set to one of the four MODE_* values, except MODE_EXPLICIT.
protected  int tileGridXOffset sample code for javax.imageio.ImageWriteParam.tileGridXOffset definition code for javax.imageio.ImageWriteParam.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 sample code for javax.imageio.ImageWriteParam.tileGridYOffset definition code for javax.imageio.ImageWriteParam.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 sample code for javax.imageio.ImageWriteParam.tileHeight definition code for javax.imageio.ImageWriteParam.tileHeight
          The height of each tile if tiling has been set, or 0 otherwise.
protected  int tileWidth sample code for javax.imageio.ImageWriteParam.tileWidth definition code for javax.imageio.ImageWriteParam.tileWidth
          The width of each tile if tiling has been set, or 0 otherwise.
protected  int tilingMode sample code for javax.imageio.ImageWriteParam.tilingMode definition code for javax.imageio.ImageWriteParam.tilingMode
          The mode controlling tiling settings, which Must be set to one of the four MODE_* values.
protected  boolean tilingSet sample code for javax.imageio.ImageWriteParam.tilingSet definition code for javax.imageio.ImageWriteParam.tilingSet
          A boolean that is true if tiling parameters have been specified.
 
Fields inherited from class javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam
controller sample code for javax.imageio.IIOParam.controller definition code for javax.imageio.IIOParam.controller , defaultController sample code for javax.imageio.IIOParam.defaultController definition code for javax.imageio.IIOParam.defaultController , destinationOffset sample code for javax.imageio.IIOParam.destinationOffset definition code for javax.imageio.IIOParam.destinationOffset , destinationType sample code for javax.imageio.IIOParam.destinationType definition code for javax.imageio.IIOParam.destinationType , sourceBands sample code for javax.imageio.IIOParam.sourceBands definition code for javax.imageio.IIOParam.sourceBands , sourceRegion sample code for javax.imageio.IIOParam.sourceRegion definition code for javax.imageio.IIOParam.sourceRegion , sourceXSubsampling sample code for javax.imageio.IIOParam.sourceXSubsampling definition code for javax.imageio.IIOParam.sourceXSubsampling , sourceYSubsampling sample code for javax.imageio.IIOParam.sourceYSubsampling definition code for javax.imageio.IIOParam.sourceYSubsampling , subsamplingXOffset sample code for javax.imageio.IIOParam.subsamplingXOffset definition code for javax.imageio.IIOParam.subsamplingXOffset , subsamplingYOffset sample code for javax.imageio.IIOParam.subsamplingYOffset definition code for javax.imageio.IIOParam.subsamplingYOffset
 
Constructor Summary
protected ImageWriteParam sample code for javax.imageio.ImageWriteParam.ImageWriteParam() definition code for javax.imageio.ImageWriteParam.ImageWriteParam() ()
          Constructs an empty ImageWriteParam.
  ImageWriteParam sample code for javax.imageio.ImageWriteParam.ImageWriteParam(java.util.Locale) definition code for javax.imageio.ImageWriteParam.ImageWriteParam(java.util.Locale) (Locale sample code for java.util.Locale definition code for java.util.Locale  locale)
          Constructs an ImageWriteParam set to use a given Locale.
 
Method Summary
 boolean canOffsetTiles sample code for javax.imageio.ImageWriteParam.canOffsetTiles() definition code for javax.imageio.ImageWriteParam.canOffsetTiles() ()
          Returns true if the writer can perform tiling with non-zero grid offsets while writing.
 boolean canWriteCompressed sample code for javax.imageio.ImageWriteParam.canWriteCompressed() definition code for javax.imageio.ImageWriteParam.canWriteCompressed() ()
          Returns true if this writer supports compression.
 boolean canWriteProgressive sample code for javax.imageio.ImageWriteParam.canWriteProgressive() definition code for javax.imageio.ImageWriteParam.canWriteProgressive() ()
          Returns true if the writer can write out images as a series of passes of progressively increasing quality.
 boolean canWriteTiles sample code for javax.imageio.ImageWriteParam.canWriteTiles() definition code for javax.imageio.ImageWriteParam.canWriteTiles() ()
          Returns true if the writer can perform tiling while writing.
 float getBitRate sample code for javax.imageio.ImageWriteParam.getBitRate(float) definition code for javax.imageio.ImageWriteParam.getBitRate(float) (float quality)
          Returns a float indicating an estimate of the number of bits of output data for each bit of input image data at the given quality level.
 int getCompressionMode sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode() ()
          Returns the current compression mode, if compression is supported.
 float getCompressionQuality sample code for javax.imageio.ImageWriteParam.getCompressionQuality() definition code for javax.imageio.ImageWriteParam.getCompressionQuality() ()
          Returns the current compression quality setting.
 String sample code for java.lang.String definition code for java.lang.String [] getCompressionQualityDescriptions sample code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() definition code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() ()
          Returns an array of Strings that may be used along with getCompressionQualityValues as part of a user interface for setting or displaying the compression quality level.
 float[] getCompressionQualityValues sample code for javax.imageio.ImageWriteParam.getCompressionQualityValues() definition code for javax.imageio.ImageWriteParam.getCompressionQualityValues() ()
          Returns an array of floats that may be used along with getCompressionQualityDescriptions as part of a user interface for setting or displaying the compression quality level.
 String sample code for java.lang.String definition code for java.lang.String getCompressionType sample code for javax.imageio.ImageWriteParam.getCompressionType() definition code for javax.imageio.ImageWriteParam.getCompressionType() ()
          Returns the currently set compression type, or null if none has been set.
 String sample code for java.lang.String definition code for java.lang.String [] getCompressionTypes sample code for javax.imageio.ImageWriteParam.getCompressionTypes() definition code for javax.imageio.ImageWriteParam.getCompressionTypes() ()
          Returns a list of available compression types, as an array or Strings, or null if a compression type may not be chosen using these interfaces.
 Locale sample code for java.util.Locale definition code for java.util.Locale getLocale sample code for javax.imageio.ImageWriteParam.getLocale() definition code for javax.imageio.ImageWriteParam.getLocale() ()
          Returns the currently set Locale, or null if only a default Locale is supported.
 String sample code for java.lang.String definition code for java.lang.String getLocalizedCompressionTypeName sample code for javax.imageio.ImageWriteParam.getLocalizedCompressionTypeName() definition code for javax.imageio.ImageWriteParam.getLocalizedCompressionTypeName() ()
          Returns a localized version of the name of the current compression type, using the Locale returned by getLocale.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension [] getPreferredTileSizes sample code for javax.imageio.ImageWriteParam.getPreferredTileSizes() definition code for javax.imageio.ImageWriteParam.getPreferredTileSizes() ()
          Returns an array of Dimensions indicating the legal size ranges for tiles as they will be encoded in the output file or stream.
 int getProgressiveMode sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode() ()
          Returns the current mode for writing the stream in a progressive manner.
 int getTileGridXOffset sample code for javax.imageio.ImageWriteParam.getTileGridXOffset() definition code for javax.imageio.ImageWriteParam.getTileGridXOffset() ()
          Returns the horizontal tile grid offset of an image as it will be written to the output stream.
 int getTileGridYOffset sample code for javax.imageio.ImageWriteParam.getTileGridYOffset() definition code for javax.imageio.ImageWriteParam.getTileGridYOffset() ()
          Returns the vertical tile grid offset of an image as it will be written to the output stream.
 int getTileHeight sample code for javax.imageio.ImageWriteParam.getTileHeight() definition code for javax.imageio.ImageWriteParam.getTileHeight() ()
          Returns the height of each tile in an image as it will be written to the output stream.
 int getTileWidth sample code for javax.imageio.ImageWriteParam.getTileWidth() definition code for javax.imageio.ImageWriteParam.getTileWidth() ()
          Returns the width of each tile in an image as it will be written to the output stream.
 int getTilingMode sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode() ()
          Returns the current tiling mode, if tiling is supported.
 boolean isCompressionLossless sample code for javax.imageio.ImageWriteParam.isCompressionLossless() definition code for javax.imageio.ImageWriteParam.isCompressionLossless() ()
          Returns true if the current compression type provides lossless compression.
 void setCompressionMode sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) (int mode)
          Specifies whether compression is to be performed, and if so how compression parameters are to be determined.
 void setCompressionQuality sample code for javax.imageio.ImageWriteParam.setCompressionQuality(float) definition code for javax.imageio.ImageWriteParam.setCompressionQuality(float) (float quality)
          Sets the compression quality to a value between 0 and 1.
 void setCompressionType sample code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) definition code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  compressionType)
          Sets the compression type to one of the values indicated by getCompressionTypes.
 void setProgressiveMode sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) (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.
 void setTiling sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) (int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset)
          Specifies that the image should be tiled in the output stream.
 void setTilingMode sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) (int mode)
          Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined.
 void unsetCompression sample code for javax.imageio.ImageWriteParam.unsetCompression() definition code for javax.imageio.ImageWriteParam.unsetCompression() ()
          Removes any previous compression type and quality settings.
 void unsetTiling sample code for javax.imageio.ImageWriteParam.unsetTiling() definition code for javax.imageio.ImageWriteParam.unsetTiling() ()
          Removes any previous tile grid parameters specified by calls to setTiling.
 
Methods inherited from class javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam
activateController sample code for javax.imageio.IIOParam.activateController() definition code for javax.imageio.IIOParam.activateController() , getController sample code for javax.imageio.IIOParam.getController() definition code for javax.imageio.IIOParam.getController() , getDefaultController sample code for javax.imageio.IIOParam.getDefaultController() definition code for javax.imageio.IIOParam.getDefaultController() , getDestinationOffset sample code for javax.imageio.IIOParam.getDestinationOffset() definition code for javax.imageio.IIOParam.getDestinationOffset() , getDestinationType sample code for javax.imageio.IIOParam.getDestinationType() definition code for javax.imageio.IIOParam.getDestinationType() , getSourceBands sample code for javax.imageio.IIOParam.getSourceBands() definition code for javax.imageio.IIOParam.getSourceBands() , getSourceRegion sample code for javax.imageio.IIOParam.getSourceRegion() definition code for javax.imageio.IIOParam.getSourceRegion() , getSourceXSubsampling sample code for javax.imageio.IIOParam.getSourceXSubsampling() definition code for javax.imageio.IIOParam.getSourceXSubsampling() , getSourceYSubsampling sample code for javax.imageio.IIOParam.getSourceYSubsampling() definition code for javax.imageio.IIOParam.getSourceYSubsampling() , getSubsamplingXOffset sample code for javax.imageio.IIOParam.getSubsamplingXOffset() definition code for javax.imageio.IIOParam.getSubsamplingXOffset() , getSubsamplingYOffset sample code for javax.imageio.IIOParam.getSubsamplingYOffset() definition code for javax.imageio.IIOParam.getSubsamplingYOffset() , hasController sample code for javax.imageio.IIOParam.hasController() definition code for javax.imageio.IIOParam.hasController() , setController sample code for javax.imageio.IIOParam.setController(javax.imageio.IIOParamController) definition code for javax.imageio.IIOParam.setController(javax.imageio.IIOParamController) , setDestinationOffset sample code for javax.imageio.IIOParam.setDestinationOffset(java.awt.Point) definition code for javax.imageio.IIOParam.setDestinationOffset(java.awt.Point) , setDestinationType sample code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier) definition code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier) , setSourceBands sample code for javax.imageio.IIOParam.setSourceBands(int[]) definition code for javax.imageio.IIOParam.setSourceBands(int[]) , setSourceRegion sample code for javax.imageio.IIOParam.setSourceRegion(java.awt.Rectangle) definition code for javax.imageio.IIOParam.setSourceRegion(java.awt.Rectangle) , setSourceSubsampling sample code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) definition code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED

public static final int MODE_DISABLED
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to disable a feature for future writes. That is, when this mode is set the stream will not be tiled, progressive, or compressed, and the relevant accessor methods will throw an IllegalStateException.

See Also:
MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode() , setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode() , setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) , getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode() , Constant Field Values

MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT

public static final int MODE_DEFAULT
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, and setCompressionMode to enable that feature for future writes. That is, when this mode is enabled the stream will be tiled, progressive, or compressed according to a sensible default chosen internally by the writer in a plug-in dependent way, and the relevant accessor methods will throw an IllegalStateException.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode() , setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode() , setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) , getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode() , Constant Field Values

MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT

public static final int MODE_EXPLICIT
A constant value that may be passed into methods such as setTilingMode or setCompressionMode to enable a feature for future writes. That is, when this mode is set the stream will be tiled or compressed according to additional information supplied to the corresponding set methods in this class and retrievable from the corresponding get methods. Note that this mode is not supported for progressive output.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode() , setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode() , setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) , getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode() , Constant Field Values

MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA

public static final int MODE_COPY_FROM_METADATA
A constant value that may be passed into methods such as setTilingMode, setProgressiveMode, or setCompressionMode to enable that feature for future writes. That is, when this mode is enabled the stream will be tiled, progressive, or compressed based on the contents of stream and/or image metadata passed into the write operation, and any relevant accessor methods will throw an IllegalStateException.

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.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode() , setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode() , setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) , getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode() , Constant Field Values

canWriteTiles sample code for javax.imageio.ImageWriteParam.canWriteTiles

protected boolean canWriteTiles
A boolean that is true if this ImageWriteParam allows tile width and tile height parameters to be set. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support writing tiles should ensure that this value is set to false.


tilingMode sample code for javax.imageio.ImageWriteParam.tilingMode

protected int tilingMode
The mode controlling tiling settings, which Must be set to one of the four MODE_* values. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not writing tiles may ignore this value.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode()

preferredTileSizes sample code for javax.imageio.ImageWriteParam.preferredTileSizes

protected Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension [] preferredTileSizes
An array of preferred tile size range pairs. The default value is null, which indicates that there are no preferred sizes. If the value is non-null, it must have an even length of at least two.

Subclasses that do not support writing tiles may ignore this value.

See Also:
getPreferredTileSizes() sample code for javax.imageio.ImageWriteParam.getPreferredTileSizes() definition code for javax.imageio.ImageWriteParam.getPreferredTileSizes()

tilingSet sample code for javax.imageio.ImageWriteParam.tilingSet

protected boolean tilingSet
A boolean that is true if tiling parameters have been specified.

Subclasses that do not support writing tiles may ignore this value.


tileWidth sample code for javax.imageio.ImageWriteParam.tileWidth

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.


tileHeight sample code for javax.imageio.ImageWriteParam.tileHeight

protected int tileHeight
The height of each tile if tiling has been set, or 0 otherwise. The initial value is 0.

Subclasses that do not support tiling may ignore this value.


canOffsetTiles sample code for javax.imageio.ImageWriteParam.canOffsetTiles

protected boolean canOffsetTiles
A boolean that is true if this ImageWriteParam allows tiling grid offset parameters to be set. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support writing tiles, or that supprt writing but not offsetting tiles must ensure that this value is set to false.


tileGridXOffset sample code for javax.imageio.ImageWriteParam.tileGridXOffset

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 0.

Subclasses that do not support offsetting tiles may ignore this value.


tileGridYOffset sample code for javax.imageio.ImageWriteParam.tileGridYOffset

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 0.

Subclasses that do not support offsetting tiles may ignore this value.


canWriteProgressive sample code for javax.imageio.ImageWriteParam.canWriteProgressive

protected boolean canWriteProgressive
A boolean that is true if this ImageWriteParam allows images to be written as a progressive sequence of increasing quality passes. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support progressive encoding must ensure that this value is set to false.


progressiveMode sample code for javax.imageio.ImageWriteParam.progressiveMode

protected int progressiveMode
The mode controlling progressive encoding, which must be set to one of the four MODE_* values, except MODE_EXPLICIT. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not support progressive encoding may ignore this value.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode()

canWriteCompressed sample code for javax.imageio.ImageWriteParam.canWriteCompressed

protected boolean canWriteCompressed
A boolean that is true if this writer can write images using compression. By default, the value is false. Subclasses must set the value manually.

Subclasses that do not support compression must ensure that this value is set to false.


compressionMode sample code for javax.imageio.ImageWriteParam.compressionMode

protected int compressionMode
The mode controlling compression settings, which must be set to one of the four MODE_* values. The default is MODE_COPY_FROM_METADATA.

Subclasses that do not support compression may ignore this value.

See Also:
MODE_DISABLED sample code for javax.imageio.ImageWriteParam.MODE_DISABLED definition code for javax.imageio.ImageWriteParam.MODE_DISABLED , MODE_EXPLICIT sample code for javax.imageio.ImageWriteParam.MODE_EXPLICIT definition code for javax.imageio.ImageWriteParam.MODE_EXPLICIT , MODE_COPY_FROM_METADATA sample code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA definition code for javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA , MODE_DEFAULT sample code for javax.imageio.ImageWriteParam.MODE_DEFAULT definition code for javax.imageio.ImageWriteParam.MODE_DEFAULT , setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int) , getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode()

compressionTypes sample code for javax.imageio.ImageWriteParam.compressionTypes

protected String sample code for java.lang.String definition code for java.lang.String [] compressionTypes
An array of Strings containing the names of the available compression types. Subclasses must set the value manually.

Subclasses that do not support compression may ignore this value.


compressionType sample code for javax.imageio.ImageWriteParam.compressionType

protected String sample code for java.lang.String definition code for java.lang.String  compressionType
A String containing the name of the current compression type, or null if none is set.

Subclasses that do not support compression may ignore this value.


compressionQuality sample code for javax.imageio.ImageWriteParam.compressionQuality

protected float compressionQuality
A float containing the current compression quality setting. The initial value is 1.0F.

Subclasses that do not support compression may ignore this value.


locale sample code for javax.imageio.ImageWriteParam.locale

protected Locale sample code for java.util.Locale definition code for java.util.Locale  locale
A Locale to be used to localize compression type names and quality descriptions, or null to use a default Locale. Subclasses must set the value manually.

Constructor Detail

ImageWriteParam sample code for javax.imageio.ImageWriteParam() definition code for javax.imageio.ImageWriteParam()

protected ImageWriteParam()
Constructs an empty ImageWriteParam. It is up to the subclass to set up the instance variables properly.


ImageWriteParam sample code for javax.imageio.ImageWriteParam(java.util.Locale) definition code for javax.imageio.ImageWriteParam(java.util.Locale)

public ImageWriteParam(Locale sample code for java.util.Locale definition code for java.util.Locale  locale)
Constructs an ImageWriteParam set to use a given Locale.

Parameters:
locale - a Locale to be used to localize compression type names and quality descriptions, or null.
Method Detail

getLocale sample code for javax.imageio.ImageWriteParam.getLocale() definition code for javax.imageio.ImageWriteParam.getLocale()

public Locale sample code for java.util.Locale definition code for java.util.Locale  getLocale()
Returns the currently set Locale, or null if only a default Locale is supported.

Returns:
the current Locale, or null.

canWriteTiles sample code for javax.imageio.ImageWriteParam.canWriteTiles() definition code for javax.imageio.ImageWriteParam.canWriteTiles()

public boolean canWriteTiles()
Returns true if the writer can perform tiling while writing. If this method returns false, then setTiling will throw an UnsupportedOperationException.

Returns:
true if the writer supports tiling.
See Also:
canOffsetTiles() sample code for javax.imageio.ImageWriteParam.canOffsetTiles() definition code for javax.imageio.ImageWriteParam.canOffsetTiles() , setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int)

canOffsetTiles sample code for javax.imageio.ImageWriteParam.canOffsetTiles() definition code for javax.imageio.ImageWriteParam.canOffsetTiles()

public boolean canOffsetTiles()
Returns true if the writer can perform tiling with non-zero grid offsets while writing. If this method returns false, then setTiling will throw an UnsupportedOperationException if the grid offset arguments are not both zero. If canWriteTiles returns false, this method will return false as well.

Returns:
true if the writer supports non-zero tile offsets.
See Also:
canWriteTiles() sample code for javax.imageio.ImageWriteParam.canWriteTiles() definition code for javax.imageio.ImageWriteParam.canWriteTiles() , setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int)

setTilingMode sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int)

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:

Parameters:
mode - The mode to use for tiling.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if canWriteTiles returns false.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if mode is not one of the modes listed above.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) , getTilingMode() sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode()

getTilingMode sample code for javax.imageio.ImageWriteParam.getTilingMode() definition code for javax.imageio.ImageWriteParam.getTilingMode()

public int getTilingMode()
Returns the current tiling mode, if tiling is supported. Otherwise throws an UnsupportedOperationException.

Returns:
the current tiling mode.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if canWriteTiles returns false.
See Also:
setTilingMode(int) sample code for javax.imageio.ImageWriteParam.setTilingMode(int) definition code for javax.imageio.ImageWriteParam.setTilingMode(int)

getPreferredTileSizes sample code for javax.imageio.ImageWriteParam.getPreferredTileSizes() definition code for javax.imageio.ImageWriteParam.getPreferredTileSizes()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension [] getPreferredTileSizes()
Returns an array of Dimensions indicating the legal size ranges for tiles as they will be encoded in the output file or stream. The returned array is a copy.

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 null is used in place of an actual array of Dimensions.

If no array is specified on the constructor, but tiling is allowed, then this method returns null.

Returns:
an array of Dimensions with an even length of at least two, or null.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.

setTiling sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int)

public void setTiling(int tileWidth,
                      int tileHeight,
                      int tileGridXOffset,
                      int tileGridYOffset)
Specifies that the image should be tiled in the output stream. The tileWidth and tileHeight parameters specify the width and height of the tiles in the file. If the tile width or height is greater than the width or height of the image, the image is not tiled in that dimension.

If canOffsetTiles returns false, then the tileGridXOffset and tileGridYOffset parameters must be zero.

Parameters:
tileWidth - the width of each tile.
tileHeight - the height of each tile.
tileGridXOffset - the horizontal offset of the tile grid.
tileGridYOffset - the vertical offset of the tile grid.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support grid offsets, and the grid offsets are not both zero.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the tile size is not within one of the allowable ranges returned by getPreferredTileSizes.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if tileWidth or tileHeight is less than or equal to 0.
See Also:
canWriteTiles sample code for javax.imageio.ImageWriteParam.canWriteTiles definition code for javax.imageio.ImageWriteParam.canWriteTiles , canOffsetTiles sample code for javax.imageio.ImageWriteParam.canOffsetTiles definition code for javax.imageio.ImageWriteParam.canOffsetTiles , getTileWidth() sample code for javax.imageio.ImageWriteParam.getTileWidth() definition code for javax.imageio.ImageWriteParam.getTileWidth() , getTileHeight() sample code for javax.imageio.ImageWriteParam.getTileHeight() definition code for javax.imageio.ImageWriteParam.getTileHeight() , getTileGridXOffset() sample code for javax.imageio.ImageWriteParam.getTileGridXOffset() definition code for javax.imageio.ImageWriteParam.getTileGridXOffset() , getTileGridYOffset() sample code for javax.imageio.ImageWriteParam.getTileGridYOffset() definition code for javax.imageio.ImageWriteParam.getTileGridYOffset()

unsetTiling sample code for javax.imageio.ImageWriteParam.unsetTiling() definition code for javax.imageio.ImageWriteParam.unsetTiling()

public void unsetTiling()
Removes any previous tile grid parameters specified by calls to setTiling.

The default implementation sets the instance variables tileWidth, tileHeight, tileGridXOffset, and tileGridYOffset to 0.

Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int)

getTileWidth sample code for javax.imageio.ImageWriteParam.getTileWidth() definition code for javax.imageio.ImageWriteParam.getTileWidth()

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 IllegalStateException is thrown.

Returns:
the tile width to be used for encoding.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling parameters have not been set.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) , getTileHeight() sample code for javax.imageio.ImageWriteParam.getTileHeight() definition code for javax.imageio.ImageWriteParam.getTileHeight()

getTileHeight sample code for javax.imageio.ImageWriteParam.getTileHeight() definition code for javax.imageio.ImageWriteParam.getTileHeight()

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 IllegalStateException is thrown.

Returns:
the tile height to be used for encoding.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling parameters have not been set.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) , getTileWidth() sample code for javax.imageio.ImageWriteParam.getTileWidth() definition code for javax.imageio.ImageWriteParam.getTileWidth()

getTileGridXOffset sample code for javax.imageio.ImageWriteParam.getTileGridXOffset() definition code for javax.imageio.ImageWriteParam.getTileGridXOffset()

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 IllegalStateException is thrown.

Returns:
the tile grid X offset to be used for encoding.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling parameters have not been set.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) , getTileGridYOffset() sample code for javax.imageio.ImageWriteParam.getTileGridYOffset() definition code for javax.imageio.ImageWriteParam.getTileGridYOffset()

getTileGridYOffset sample code for javax.imageio.ImageWriteParam.getTileGridYOffset() definition code for javax.imageio.ImageWriteParam.getTileGridYOffset()

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 IllegalStateException is thrown.

Returns:
the tile grid Y offset to be used for encoding.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support tiling.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the tiling parameters have not been set.
See Also:
setTiling(int, int, int, int) sample code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) definition code for javax.imageio.ImageWriteParam.setTiling(int, int, int, int) , getTileGridXOffset() sample code for javax.imageio.ImageWriteParam.getTileGridXOffset() definition code for javax.imageio.ImageWriteParam.getTileGridXOffset()

canWriteProgressive sample code for javax.imageio.ImageWriteParam.canWriteProgressive() definition code for javax.imageio.ImageWriteParam.canWriteProgressive()

public boolean canWriteProgressive()
Returns true if the writer can write out images as a series of passes of progressively increasing quality.

Returns:
true if the writer supports progressive encoding.
See Also:
setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int) , getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode()

setProgressiveMode sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int)

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 UnsupportedOperationException will be thrown.

The mode argument determines how the progression parameters are chosen, and must be either MODE_DISABLED, MODE_COPY_FROM_METADATA, or MODE_DEFAULT. Otherwise an IllegalArgumentException is thrown.

The modes are interpreted as follows:

The default is MODE_COPY_FROM_METADATA.

Parameters:
mode - The mode for setting progression in the output stream.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support progressive encoding.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if mode is not one of the modes listed above.
See Also:
getProgressiveMode() sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode()

getProgressiveMode sample code for javax.imageio.ImageWriteParam.getProgressiveMode() definition code for javax.imageio.ImageWriteParam.getProgressiveMode()

public int getProgressiveMode()
Returns the current mode for writing the stream in a progressive manner.

Returns:
the current mode for progressive encoding.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support progressive encoding.
See Also:
setProgressiveMode(int) sample code for javax.imageio.ImageWriteParam.setProgressiveMode(int) definition code for javax.imageio.ImageWriteParam.setProgressiveMode(int)

canWriteCompressed sample code for javax.imageio.ImageWriteParam.canWriteCompressed() definition code for javax.imageio.ImageWriteParam.canWriteCompressed()

public boolean canWriteCompressed()
Returns true if this writer supports compression.

Returns:
true if the writer supports compression.

setCompressionMode sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int)

public void setCompressionMode(int mode)
Specifies whether compression is to be performed, and if so how compression parameters are to be determined. The mode argument must be one of the four modes, interpreted as follows:

The default is MODE_COPY_FROM_METADATA.

Parameters:
mode - The mode for setting compression in the output stream.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression, or does not support the requested mode.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if mode is not one of the modes listed above.
See Also:
getCompressionMode() sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode()

getCompressionMode sample code for javax.imageio.ImageWriteParam.getCompressionMode() definition code for javax.imageio.ImageWriteParam.getCompressionMode()

public int getCompressionMode()
Returns the current compression mode, if compression is supported.

Returns:
the current compression mode.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
See Also:
setCompressionMode(int) sample code for javax.imageio.ImageWriteParam.setCompressionMode(int) definition code for javax.imageio.ImageWriteParam.setCompressionMode(int)

getCompressionTypes sample code for javax.imageio.ImageWriteParam.getCompressionTypes() definition code for javax.imageio.ImageWriteParam.getCompressionTypes()

public String sample code for java.lang.String definition code for java.lang.String [] getCompressionTypes()
Returns a list of available compression types, as an array or Strings, or null if a compression type may not be chosen using these interfaces. The array returned is a copy.

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 UnsupportedOperationException if not. Otherwise, it returns a clone of the compressionTypes instance variable if it is non-null, or else returns null.

Returns:
an array of Strings containing the (non-localized) names of available compression types, or null.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.

setCompressionType sample code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) definition code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String)

public void setCompressionType(String sample code for java.lang.String definition code for java.lang.String  compressionType)
Sets the compression type to one of the values indicated by getCompressionTypes. If a value of null is passed in, any previous setting is removed.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, it calls getCompressionTypes and checks if compressionType is one of the legal values. If it is, the compressionType instance variable is set. If compressionType is null, the instance variable is set without performing any checking.

Parameters:
compressionType - one of the Strings returned by getCompressionTypes, or null to remove any previous setting.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if there are no settable compression types.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if compressionType is non-null but is not one of the values returned by getCompressionTypes.
See Also:
getCompressionTypes() sample code for javax.imageio.ImageWriteParam.getCompressionTypes() definition code for javax.imageio.ImageWriteParam.getCompressionTypes() , getCompressionType() sample code for javax.imageio.ImageWriteParam.getCompressionType() definition code for javax.imageio.ImageWriteParam.getCompressionType() , unsetCompression() sample code for javax.imageio.ImageWriteParam.unsetCompression() definition code for javax.imageio.ImageWriteParam.unsetCompression()

getCompressionType sample code for javax.imageio.ImageWriteParam.getCompressionType() definition code for javax.imageio.ImageWriteParam.getCompressionType()

public String sample code for java.lang.String definition code for java.lang.String  getCompressionType()
Returns the currently set compression type, or null if none has been set. The type is returned as a String from among those returned by getCompressionTypes. If no compression type has been set, null is returned.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, it returns the value of the compressionType instance variable.

Returns:
the current compression type as a String, or null if no type is set.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
See Also:
setCompressionType(java.lang.String) sample code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) definition code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String)

unsetCompression sample code for javax.imageio.ImageWriteParam.unsetCompression() definition code for javax.imageio.ImageWriteParam.unsetCompression()

public void unsetCompression()
Removes any previous compression type and quality settings.

The default implementation sets the instance variable compressionType to null, and the instance variable compressionQuality to 1.0F.

Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the plug-in does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
See Also:
setCompressionType(java.lang.String) sample code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) definition code for javax.imageio.ImageWriteParam.setCompressionType(java.lang.String) , setCompressionQuality(float) sample code for javax.imageio.ImageWriteParam.setCompressionQuality(float) definition code for javax.imageio.ImageWriteParam.setCompressionQuality(float)

getLocalizedCompressionTypeName sample code for javax.imageio.ImageWriteParam.getLocalizedCompressionTypeName() definition code for javax.imageio.ImageWriteParam.getLocalizedCompressionTypeName()

public String sample code for java.lang.String definition code for java.lang.String  getLocalizedCompressionTypeName()
Returns a localized version of the name of the current compression type, using the Locale returned by getLocale.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, if compressionType is non-null the value of getCompressionType is returned as a convenience.

Returns:
a String containing a localized version of the name of the current compression type.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if no compression type is set.

isCompressionLossless sample code for javax.imageio.ImageWriteParam.isCompressionLossless() definition code for javax.imageio.ImageWriteParam.isCompressionLossless()

public boolean isCompressionLossless()
Returns true if the current compression type provides lossless compression. If a plug-in provides only one mandatory compression type, then this method may be called without calling setCompressionType first.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks whether compression is supported and the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null true is returned as a convenience.

Returns:
true if the current compression type is lossless.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.

setCompressionQuality sample code for javax.imageio.ImageWriteParam.setCompressionQuality(float) definition code for javax.imageio.ImageWriteParam.setCompressionQuality(float)

public void setCompressionQuality(float quality)
Sets the compression quality to a value between 0 and 1. Only a single compression quality setting is supported by default; writers can provide extended versions of ImageWriteParam that offer more control. For lossy compression schemes, the compression quality should control the tradeoff between file size and image quality (for example, by choosing quantization tables when writing JPEG images). For lossless schemes, the compression quality may be used to control the tradeoff between file size and time taken to perform the compression (for example, by optimizing row filters and setting the ZLIB compression level when writing PNG images).

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 IllegalStateException is thrown.

The default implementation checks that compression is supported, and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() returns null or compressionType is non-null it sets the compressionQuality instance variable.

Parameters:
quality - a float between 0and 1 indicating the desired quality level.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if quality is not between 0and 1, inclusive.
See Also:
getCompressionQuality() sample code for javax.imageio.ImageWriteParam.getCompressionQuality() definition code for javax.imageio.ImageWriteParam.getCompressionQuality()

getCompressionQuality sample code for javax.imageio.ImageWriteParam.getCompressionQuality() definition code for javax.imageio.ImageWriteParam.getCompressionQuality()

public float getCompressionQuality()
Returns the current compression quality setting.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns the value of the compressionQuality instance variable.

Returns:
the current compression quality setting.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.
See Also:
setCompressionQuality(float) sample code for javax.imageio.ImageWriteParam.setCompressionQuality(float) definition code for javax.imageio.ImageWriteParam.setCompressionQuality(float)

getBitRate sample code for javax.imageio.ImageWriteParam.getBitRate(float) definition code for javax.imageio.ImageWriteParam.getBitRate(float)

public float getBitRate(float quality)
Returns a float indicating an estimate of the number of bits of output data for each bit of input image data at the given quality level. The value will typically lie between 0 and 1, with smaller values indicating more compression. A special value of -1.0F is used to indicate that no estimate is available.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, and quality is within bounds, it returns -1.0.

Parameters:
quality - the quality setting whose bit rate is to be queried.
Returns:
an estimate of the compressed bit rate, or -1.0F if no estimate is available.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if quality is not between 0and 1, inclusive.

getCompressionQualityDescriptions sample code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() definition code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions()

public String sample code for java.lang.String definition code for java.lang.String [] getCompressionQualityDescriptions()
Returns an array of Strings that may be used along with getCompressionQualityValues as part of a user interface for setting or displaying the compression quality level. The String with index i provides a description of the range of quality levels between getCompressionQualityValues[i] and getCompressionQualityValues[i + 1]. Note that the length of the array returned from getCompressionQualityValues will always be one greater than that returned from getCompressionQualityDescriptions.

As an example, the strings "Good", "Better", and "Best" could be associated with the ranges [0, .33), [.33, .66), and [.66, 1.0]. In this case, getCompressionQualityDescriptions would return { "Good", "Better", "Best" } and getCompressionQualityValues would return { 0.0F, .33F, .66F, 1.0F }.

If no descriptions are available, null is returned. If null is returned from getCompressionQualityValues, this method must also return null.

The descriptions should be localized for the Locale returned by getLocale, if it is non-null.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns null.

Returns:
an array of Strings containing localized descriptions of the compression quality levels.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.
See Also:
getCompressionQualityValues() sample code for javax.imageio.ImageWriteParam.getCompressionQualityValues() definition code for javax.imageio.ImageWriteParam.getCompressionQualityValues()

getCompressionQualityValues sample code for javax.imageio.ImageWriteParam.getCompressionQualityValues() definition code for javax.imageio.ImageWriteParam.getCompressionQualityValues()

public float[] getCompressionQualityValues()
Returns an array of floats that may be used along with getCompressionQualityDescriptions as part of a user interface for setting or displaying the compression quality level. See getCompressionQualityDescriptions sample code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() definition code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() for more information.

If no descriptions are available, null is returned. If null is returned from getCompressionQualityDescriptions, this method must also return null.

If there are multiple compression types but none has been set, an IllegalStateException is thrown.

The default implementation checks that compression is supported and that the compression mode is MODE_EXPLICIT. If so, if getCompressionTypes() is null or getCompressionType() is non-null, it returns null.

Returns:
an array of floats indicating the boundaries between the compression quality levels as described by the Strings from getCompressionQualityDescriptions.
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if the writer does not support compression.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the compression mode is not MODE_EXPLICIT.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the set of legal compression types is non-null and the current compression type is null.
See Also:
getCompressionQualityDescriptions() sample code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions() definition code for javax.imageio.ImageWriteParam.getCompressionQualityDescriptions()