Class J2KImageWriteParam


  • public class J2KImageWriteParam
    extends ImageWriteParam
    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:

    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 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.
    • Constructor Detail

      • J2KImageWriteParam

        public J2KImageWriteParam​(Locale locale)
        Constructor which sets the Locale.
        Parameters:
        locale - a Locale to be used to localize compression type names and quality descriptions, or null.
      • J2KImageWriteParam

        public J2KImageWriteParam()
        Constructs a J2KImageWriteParam object with default values for all parameters.
    • Method Detail

      • setNumDecompositionLevels

        public void setNumDecompositionLevels​(int numDecompositionLevels)
        Sets numDecompositionLevels.
        Parameters:
        numDecompositionLevels - the number of decomposition levels.
        Throws:
        IllegalArgumentException - if numDecompositionLevels is negative or greater than 32.
        See Also:
        getNumDecompositionLevels()
      • getNumDecompositionLevels

        public int getNumDecompositionLevels()
        Gets numDecompositionLevels.
        Returns:
        the number of decomposition levels.
        See Also:
        setNumDecompositionLevels(int)
      • setEncodingRate

        public void setEncodingRate​(double rate)
        Sets encodingRate.
        Parameters:
        rate - the encoding rate in bits-per-pixel.
        See Also:
        getEncodingRate()
      • getEncodingRate

        public double getEncodingRate()
        Gets encodingRate.
        Returns:
        the encoding rate in bits-per-pixel.
        See Also:
        setEncodingRate(double)
      • setLossless

        public void setLossless​(boolean lossless)
        Sets lossless.
        Parameters:
        lossless - whether the compression scheme is lossless.
        See Also:
        getLossless()
      • getLossless

        public boolean getLossless()
        Gets lossless.
        Returns:
        whether the compression scheme is lossless.
        See Also:
        setLossless(boolean)
      • setFilter

        public void setFilter​(String value)
        Sets filter.
        Parameters:
        value - which wavelet filters to use for the specified tile-components.
        See Also:
        getFilter()
      • getFilter

        public String getFilter()
        Gets filters.
        Returns:
        which wavelet filters to use for the specified tile-components.
        See Also:
        setFilter(String)
      • setComponentTransformation

        public void setComponentTransformation​(boolean value)
        Sets componentTransformation.
        Parameters:
        value - whether to utilize the component transformation.
        See Also:
        getComponentTransformation()
      • getComponentTransformation

        public boolean getComponentTransformation()
        Gets componentTransformation.
        Returns:
        whether to utilize the component transformation.
        See Also:
        setComponentTransformation(boolean)
      • setCodeBlockSize

        public void setCodeBlockSize​(int[] value)
        Sets codeBlockSize.
        Parameters:
        value - the maximum code-block size to use per tile-component.
        See Also:
        getCodeBlockSize()
      • getCodeBlockSize

        public int[] getCodeBlockSize()
        Gets codeBlockSize.
        Returns:
        the maximum code-block size to use per tile-component.
        See Also:
        setCodeBlockSize(int[])
      • setSOP

        public void setSOP​(boolean value)
        Sets SOP.
        Parameters:
        value - whether start of packet (SOP) markers should be used.
        See Also:
        getSOP()
      • getSOP

        public boolean getSOP()
        Gets SOP.
        Returns:
        whether start of packet (SOP) markers should be used.
        See Also:
        setSOP(boolean)
      • setEPH

        public void setEPH​(boolean value)
        Sets EPH.
        Parameters:
        value - whether end of packet header (EPH) markers should be used.
        See Also:
        getEPH()
      • getEPH

        public boolean getEPH()
        Gets EPH.
        Returns:
        whether end of packet header (EPH) markers should be used.
        See Also:
        setEPH(boolean)
      • setProgressionType

        public void setProgressionType​(String value)
        Sets progressionType.
        Parameters:
        value - which type of progression should be used when generating the codestream.
        See Also:
        getProgressionType()
      • getProgressionType

        public String getProgressionType()
        Gets progressionType.
        Returns:
        which type of progression should be used when generating the codestream.
        See Also:
        setProgressionType(String)
      • setWriteCodeStreamOnly

        public void setWriteCodeStreamOnly​(boolean value)
        Sets writeCodeStreamOnly.
        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()
        Gets writeCodeStreamOnly.
        Returns:
        whether the jpeg2000 code stream only or the jp2 format will be written into the output.
        See Also:
        setWriteCodeStreamOnly(boolean)