Class J2KImageWriteParam


  • public class J2KImageWriteParam
    extends javax.imageio.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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FILTER_53
      The filter for lossless compression.
      static java.lang.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 a J2KImageWriteParam object with default values for all parameters.
      J2KImageWriteParam​(java.util.Locale locale)
      Constructor which sets the Locale.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int[] getCodeBlockSize()
      Gets codeBlockSize.
      boolean getComponentTransformation()
      Gets componentTransformation.
      double getEncodingRate()
      Gets encodingRate.
      boolean getEPH()
      Gets EPH.
      java.lang.String getFilter()
      Gets filters.
      boolean getLossless()
      Gets lossless.
      int getNumDecompositionLevels()
      Gets numDecompositionLevels.
      java.lang.String getProgressionType()
      Gets progressionType.
      boolean getSOP()
      Gets SOP.
      boolean getWriteCodeStreamOnly()
      Gets writeCodeStreamOnly.
      void setCodeBlockSize​(int[] value)
      Sets codeBlockSize.
      void setComponentTransformation​(boolean value)
      Sets componentTransformation.
      void setEncodingRate​(double rate)
      Sets encodingRate.
      void setEPH​(boolean value)
      Sets EPH.
      void setFilter​(java.lang.String value)
      Sets filter.
      void setLossless​(boolean lossless)
      Sets lossless.
      void setNumDecompositionLevels​(int numDecompositionLevels)
      Sets numDecompositionLevels.
      void setProgressionType​(java.lang.String value)
      Sets progressionType.
      void setSOP​(boolean value)
      Sets SOP.
      void setWriteCodeStreamOnly​(boolean value)
      Sets writeCodeStreamOnly.
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FILTER_97

        public static final java.lang.String FILTER_97
        The filter for lossy compression.
        See Also:
        Constant Field Values
      • FILTER_53

        public static final java.lang.String FILTER_53
        The filter for lossless compression.
        See Also:
        Constant Field Values
    • Constructor Detail

      • J2KImageWriteParam

        public J2KImageWriteParam​(java.util.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:
        java.lang.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​(java.lang.String value)
        Sets filter.
        Parameters:
        value - which wavelet filters to use for the specified tile-components.
        See Also:
        getFilter()
      • getFilter

        public java.lang.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​(java.lang.String value)
        Sets progressionType.
        Parameters:
        value - which type of progression should be used when generating the codestream.
        See Also:
        getProgressionType()
      • getProgressionType

        public java.lang.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)