Class J2KImageWriteParam
- java.lang.Object
-
- javax.imageio.IIOParam
-
- javax.imageio.ImageWriteParam
-
- com.sun.media.imageio.plugins.jpeg2000.J2KImageWriteParam
-
public class J2KImageWriteParam extends ImageWriteParam
A subclass ofImageWriteParam
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:
JPEG 2000 Plugin Decoding Parameters Parameter Name Description numDecompositionLevels The number of decomposition levels to generate. This value must be in the range 0 ≤ numDecompositionLevels ≤ 32
. The default value is5
. Note that the number of resolution levels isnumDecompositionLevels + 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
Fields Modifier and Type Field Description static String
FILTER_53
The filter for lossless compression.static String
FILTER_97
The 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, tilingSet
-
Fields inherited from class javax.imageio.IIOParam
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset
-
-
Constructor Summary
Constructors Constructor Description J2KImageWriteParam()
Constructs aJ2KImageWriteParam
object with default values for all parameters.J2KImageWriteParam(Locale locale)
Constructor which sets theLocale
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getCodeBlockSize()
GetscodeBlockSize
.boolean
getComponentTransformation()
GetscomponentTransformation
.double
getEncodingRate()
GetsencodingRate
.boolean
getEPH()
GetsEPH
.String
getFilter()
Getsfilters
.boolean
getLossless()
Getslossless
.int
getNumDecompositionLevels()
GetsnumDecompositionLevels
.String
getProgressionType()
GetsprogressionType
.boolean
getSOP()
GetsSOP
.boolean
getWriteCodeStreamOnly()
GetswriteCodeStreamOnly
.void
setCodeBlockSize(int[] value)
SetscodeBlockSize
.void
setComponentTransformation(boolean value)
SetscomponentTransformation
.void
setEncodingRate(double rate)
SetsencodingRate
.void
setEPH(boolean value)
SetsEPH
.void
setFilter(String value)
Setsfilter
.void
setLossless(boolean lossless)
Setslossless
.void
setNumDecompositionLevels(int numDecompositionLevels)
SetsnumDecompositionLevels
.void
setProgressionType(String value)
SetsprogressionType
.void
setSOP(boolean value)
SetsSOP
.void
setWriteCodeStreamOnly(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, unsetTiling
-
Methods 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 Detail
-
FILTER_97
public static final String FILTER_97
The filter for lossy compression.- See Also:
- Constant Field Values
-
FILTER_53
public static final String FILTER_53
The filter for lossless compression.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
J2KImageWriteParam
public J2KImageWriteParam(Locale locale)
Constructor which sets theLocale
.- Parameters:
locale
- aLocale
to be used to localize compression type names and quality descriptions, ornull
.
-
J2KImageWriteParam
public J2KImageWriteParam()
Constructs aJ2KImageWriteParam
object with default values for all parameters.
-
-
Method Detail
-
setNumDecompositionLevels
public void setNumDecompositionLevels(int numDecompositionLevels)
SetsnumDecompositionLevels
.- Parameters:
numDecompositionLevels
- the number of decomposition levels.- Throws:
IllegalArgumentException
- ifnumDecompositionLevels
is negative or greater than 32.- See Also:
getNumDecompositionLevels()
-
getNumDecompositionLevels
public int getNumDecompositionLevels()
GetsnumDecompositionLevels
.- Returns:
- the number of decomposition levels.
- See Also:
setNumDecompositionLevels(int)
-
setEncodingRate
public void setEncodingRate(double rate)
SetsencodingRate
.- Parameters:
rate
- the encoding rate in bits-per-pixel.- See Also:
getEncodingRate()
-
getEncodingRate
public double getEncodingRate()
GetsencodingRate
.- Returns:
- the encoding rate in bits-per-pixel.
- See Also:
setEncodingRate(double)
-
setLossless
public void setLossless(boolean lossless)
Setslossless
.- Parameters:
lossless
- whether the compression scheme is lossless.- See Also:
getLossless()
-
getLossless
public boolean getLossless()
Getslossless
.- Returns:
- whether the compression scheme is lossless.
- See Also:
setLossless(boolean)
-
setFilter
public void setFilter(String value)
Setsfilter
.- Parameters:
value
- which wavelet filters to use for the specified tile-components.- See Also:
getFilter()
-
getFilter
public String getFilter()
Getsfilters
.- Returns:
- which wavelet filters to use for the specified tile-components.
- See Also:
setFilter(String)
-
setComponentTransformation
public void setComponentTransformation(boolean value)
SetscomponentTransformation
.- Parameters:
value
- whether to utilize the component transformation.- See Also:
getComponentTransformation()
-
getComponentTransformation
public boolean getComponentTransformation()
GetscomponentTransformation
.- Returns:
- whether to utilize the component transformation.
- See Also:
setComponentTransformation(boolean)
-
setCodeBlockSize
public void setCodeBlockSize(int[] value)
SetscodeBlockSize
.- Parameters:
value
- the maximum code-block size to use per tile-component.- See Also:
getCodeBlockSize()
-
getCodeBlockSize
public int[] getCodeBlockSize()
GetscodeBlockSize
.- Returns:
- the maximum code-block size to use per tile-component.
- See Also:
setCodeBlockSize(int[])
-
setSOP
public void setSOP(boolean value)
SetsSOP
.- Parameters:
value
- whether start of packet (SOP) markers should be used.- See Also:
getSOP()
-
getSOP
public boolean getSOP()
GetsSOP
.- Returns:
- whether start of packet (SOP) markers should be used.
- See Also:
setSOP(boolean)
-
setEPH
public void setEPH(boolean value)
SetsEPH
.- Parameters:
value
- whether end of packet header (EPH) markers should be used.- See Also:
getEPH()
-
getEPH
public boolean getEPH()
GetsEPH
.- Returns:
- whether end of packet header (EPH) markers should be used.
- See Also:
setEPH(boolean)
-
setProgressionType
public void setProgressionType(String value)
SetsprogressionType
.- Parameters:
value
- which type of progression should be used when generating the codestream.- See Also:
getProgressionType()
-
getProgressionType
public String getProgressionType()
GetsprogressionType
.- Returns:
- which type of progression should be used when generating the codestream.
- See Also:
setProgressionType(String)
-
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()
-
getWriteCodeStreamOnly
public boolean getWriteCodeStreamOnly()
GetswriteCodeStreamOnly
.- Returns:
- whether the jpeg2000 code stream only or the jp2 format will be written into the output.
- See Also:
setWriteCodeStreamOnly(boolean)
-
-