Class J2KImageWriteParam
java.lang.Object
javax.imageio.IIOParam
javax.imageio.ImageWriteParam
com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam
A subclass of
ImageWriteParam for writing images in
the JPEG 2000 format.
JPEG 2000 plugin supports to losslessly or lossy compress gray-scale, RGB, and RGBA images with byte, unsigned short or short data type. It also supports losslessly compress bilevel, and 8-bit color indexed images. The result data is in the of JP2 format -- JPEG 2000 Part 1 or baseline format.
The parameters for encoding JPEG 2000 are listed in the following table:
| Parameter Name | Description |
|---|---|
| numDecompositionLevels | The number of decomposition levels to generate. This value must
be in the range
0 ≤ numDecompositionLevels ≤ 32
. The default value is 5. Note that the number
of resolution levels is
numDecompositionLevels + 1.
The number of decomposition levels is constant across
all components and all tiles.
|
| encodingRate | The bitrate in bits-per-pixel for encoding. Should be set when
lossy compression scheme is used. With the default value
Double.MAX_VALUE, a lossless compression will be done.
|
| lossless | Indicates using the lossless scheme or not. It is equivalent to
use reversible quantization and 5x3 integer wavelet filters. The
default is true.
|
| componentTransformation | Specifies to utilize the component transformation on some tiles. If the wavelet transform is reversible (w5x3 filter), the Reversible Component Transformation (RCT) is applied. If not reversible (w9x7 filter), the Irreversible Component Transformation (ICT) is used. |
| filters | Specifies which wavelet filters to use for the specified tile-components. JPEG 2000 part I only supports w5x3 and w9x7 filters. |
| codeBlockSize | Specifies the maximum code-block size to use for tile-component. The maximum width and height is 1024, however the block size (i.e. width x height) must not exceed 4096. The minimum width and height is 4. The default values are (64, 64). |
| progressionType | Specifies which type of progression should be used when generating
the codestream.
The format is ont of the progression types defined below: res : Resolution-Layer-Component-Position layer: Layer-Resolution-Component-Position res-pos: Resolution-Position-Component-Layer pos-comp: Position-Component-Resolution-Layer comp-pos: Component-Position-Resolution-Layer |
| SOP | Specifies whether start of packet (SOP) markers should be used. true enables, false disables it. The default value is false. |
| EPH | Specifies whether end of packet header (EPH) markers should be used. true enables, false disables it. The default value is false. |
| writeCodeStreamOnly | Specifies whether write only the jpeg2000 code stream, i.e, no any box is written. The default value is false. |
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe filter for lossless compression.static final StringThe filter for lossy compression.Fields inherited from class javax.imageio.ImageWriteParam
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, compressionMode, compressionQuality, compressionType, compressionTypes, locale, MODE_COPY_FROM_METADATA, MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, preferredTileSizes, progressiveMode, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, tilingMode, tilingSetFields inherited from class javax.imageio.IIOParam
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aJ2KImageWriteParamobject with default values for all parameters.J2KImageWriteParam(Locale locale) Constructor which sets theLocale. -
Method Summary
Modifier and TypeMethodDescriptionint[]GetscodeBlockSize.booleanGetscomponentTransformation.doubleGetsencodingRate.booleangetEPH()GetsEPH.Getsfilters.booleanGetslossless.intGetsnumDecompositionLevels.GetsprogressionType.booleangetSOP()GetsSOP.booleanGetswriteCodeStreamOnly.voidsetCodeBlockSize(int[] value) SetscodeBlockSize.voidsetComponentTransformation(boolean value) SetscomponentTransformation.voidsetEncodingRate(double rate) SetsencodingRate.voidsetEPH(boolean value) SetsEPH.voidSetsfilter.voidsetLossless(boolean lossless) Setslossless.voidsetNumDecompositionLevels(int numDecompositionLevels) SetsnumDecompositionLevels.voidsetProgressionType(String value) SetsprogressionType.voidsetSOP(boolean value) SetsSOP.voidsetWriteCodeStreamOnly(boolean value) SetswriteCodeStreamOnly.Methods inherited from class javax.imageio.ImageWriteParam
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, getBitRate, getCompressionMode, getCompressionQuality, getCompressionQualityDescriptions, getCompressionQualityValues, getCompressionType, getCompressionTypes, getLocale, getLocalizedCompressionTypeName, getPreferredTileSizes, getProgressiveMode, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTilingMode, isCompressionLossless, setCompressionMode, setCompressionQuality, setCompressionType, setProgressiveMode, setTiling, setTilingMode, unsetCompression, unsetTilingMethods inherited from class javax.imageio.IIOParam
activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setDestinationType, setSourceBands, setSourceRegion, setSourceSubsampling
-
Field Details
-
FILTER_97
The filter for lossy compression.- See Also:
-
FILTER_53
The filter for lossless compression.- See Also:
-
-
Constructor Details
-
J2KImageWriteParam
Constructor which sets theLocale.- Parameters:
locale- aLocaleto be used to localize compression type names and quality descriptions, ornull.
-
J2KImageWriteParam
public J2KImageWriteParam()Constructs aJ2KImageWriteParamobject with default values for all parameters.
-
-
Method Details
-
setNumDecompositionLevels
public void setNumDecompositionLevels(int numDecompositionLevels) SetsnumDecompositionLevels.- Parameters:
numDecompositionLevels- the number of decomposition levels.- Throws:
IllegalArgumentException- ifnumDecompositionLevelsis negative or greater than 32.- See Also:
-
getNumDecompositionLevels
public int getNumDecompositionLevels()GetsnumDecompositionLevels.- Returns:
- the number of decomposition levels.
- See Also:
-
setEncodingRate
public void setEncodingRate(double rate) SetsencodingRate.- Parameters:
rate- the encoding rate in bits-per-pixel.- See Also:
-
getEncodingRate
public double getEncodingRate()GetsencodingRate.- Returns:
- the encoding rate in bits-per-pixel.
- See Also:
-
setLossless
public void setLossless(boolean lossless) Setslossless.- Parameters:
lossless- whether the compression scheme is lossless.- See Also:
-
getLossless
public boolean getLossless()Getslossless.- Returns:
- whether the compression scheme is lossless.
- See Also:
-
setFilter
Setsfilter.- Parameters:
value- which wavelet filters to use for the specified tile-components.- See Also:
-
getFilter
Getsfilters.- Returns:
- which wavelet filters to use for the specified tile-components.
- See Also:
-
setComponentTransformation
public void setComponentTransformation(boolean value) SetscomponentTransformation.- Parameters:
value- whether to utilize the component transformation.- See Also:
-
getComponentTransformation
public boolean getComponentTransformation()GetscomponentTransformation.- Returns:
- whether to utilize the component transformation.
- See Also:
-
setCodeBlockSize
public void setCodeBlockSize(int[] value) SetscodeBlockSize.- Parameters:
value- the maximum code-block size to use per tile-component.- See Also:
-
getCodeBlockSize
public int[] getCodeBlockSize()GetscodeBlockSize.- Returns:
- the maximum code-block size to use per tile-component.
- See Also:
-
setSOP
public void setSOP(boolean value) SetsSOP.- Parameters:
value- whether start of packet (SOP) markers should be used.- See Also:
-
getSOP
public boolean getSOP()GetsSOP.- Returns:
- whether start of packet (SOP) markers should be used.
- See Also:
-
setEPH
public void setEPH(boolean value) SetsEPH.- Parameters:
value- whether end of packet header (EPH) markers should be used.- See Also:
-
getEPH
public boolean getEPH()GetsEPH.- Returns:
- whether end of packet header (EPH) markers should be used.
- See Also:
-
setProgressionType
SetsprogressionType.- Parameters:
value- which type of progression should be used when generating the codestream.- See Also:
-
getProgressionType
GetsprogressionType.- Returns:
- which type of progression should be used when generating the codestream.
- See Also:
-
setWriteCodeStreamOnly
public void setWriteCodeStreamOnly(boolean value) SetswriteCodeStreamOnly.- Parameters:
value- Whether the jpeg2000 code stream only or the jp2 format will be written into the output.- See Also:
-
getWriteCodeStreamOnly
public boolean getWriteCodeStreamOnly()GetswriteCodeStreamOnly.- Returns:
- whether the jpeg2000 code stream only or the jp2 format will be written into the output.
- See Also:
-