Visual Basic (Declaration) | |
---|---|
Public Class CodecsJpeg2000Options |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public class CodecsJpeg2000Options |
C++/CLI | |
---|---|
public ref class CodecsJpeg2000Options |
Visual Basic | Copy Code |
---|---|
Public Sub CodecsJpeg2000OptionsExample() |
C# | Copy Code |
---|---|
public void CodecsJpeg2000OptionsExample() |
The JPEG2000 image format offers both superior compression performance and robust file handling. Some J2K options can have a direct impact on compression performance, while others primarily affect resulting file size. Notes on Advanced options continue below.
Main options (listed above) include:
-
Color Transforms
-
Compression Settings
-
Multiple resolution representation (Wavelet Decomposition Level)
-
Random codestream access and processing (Progression Order)
-
Progressive transmission (Advanced)
-
Tile Size
-
Error resilience for transmission in noisy environments, such as wireless and the Internet.
-
Region-of-Interest coding.
Using this structure with LEAD CMW (Cmw) or TIFF with LEAD Wavelet CMW compression (TifCmw) files
When using this structure with Cmw or TifCmw files, only the following data properties are required:
CodecsJpeg2000SaveOptions.CompressionControl
CodecsJpeg2000SaveOptions.CompressionRatio
CodecsJpeg2000SaveOptions.TargetFileSize
CodecsJpeg2000SaveOptions.ProgressingOrder
The resulting file size/ compression ratio can be determined in several ways. Depending on the value set in the CompressionControl property, the user can set the size of the target file, the actual compression ratio to use during compression or the quality factor to use during compression. If the CodecsJpeg2000SaveOptions.CompressionControl property is set to Ratio, then the compression used is based on the compression ratio in the CodecsJpeg2000SaveOptions.CompressionRatio property. If the CodecsJpeg2000SaveOptions.CompressionControl property is set to TargetSize, the compression used is based on the desired target file size in the CodecsJpeg2000SaveOptions.TargetFileSize property. If the CodecsJpeg2000SaveOptions.CompressionControl property is set to QualityFactor, then the compression used is based on the QualityFactor passed to the Save functions.
Lossless Compression
For lossless compression, set the CodecsJpeg2000SaveOptions.CompressionControl property to Lossless.
Lossy Compression Quantization
There are two types of quantization for Lossy compression: Scalar Derived Quantization and Scalar Expounded Quantization.
The exponent/mantissa pairs are either signaled in the codestream for every sub-band (expounded quantization) or else signaled only for the Low Pass sub-band and derived for all other sub-bands (derived quantization). In the case of derived quantization, all exponent/mantissa pairs are derived from the single exponent/mantissa pair corresponding to the Low pass sub-band.
The quantization step size for a sub-band is calculated from the dynamic range of the sub-band using the following equation, where R = bpp for the sub-band:
Quantization Step = (2 (R - Exponent) ) * [1 + (Mantissa / 2048)]
If the value of the CodecsJpeg2000SaveOptions.CompressionControl property is Ratio, QualityFactor or TargetSize, and the value of the CodecsJpeg2000SaveOptions.AlphaChannelLossless property is true, the compressed J2K/JP2 file will have three lossy components (red, green and blue), in addition to the lossless alpha component.
If the value of the CodecsJpeg2000SaveOptions.CompressionControl property is Lossless, the value of CodecsJpeg2000SaveOptions.AlphaChannelLossless will be ignored and all the components will be lossless.
The alpha channel can be dithered using ColorResolutionCommand and DynamicBinaryCommand externally, and before saving a J2K/JP2 file, in case a better alpha channel quality is desired.
Tile and Canvas Settings
The values of the CodecsJpeg2000SaveOptions.ImageAreaHorizontalOffset, CodecsJpeg2000SaveOptions.ImageAreaVerticalOffset, CodecsJpeg2000SaveOptions.ReferenceTileHeight, CodecsJpeg2000SaveOptions.ReferenceTileWidth, CodecsJpeg2000SaveOptions.TileHorizontalOffset and CodecsJpeg2000SaveOptions.TileVerticalOffset properties are used to create tiles within the image. Arbitrary tile sizes are allowed. All tiles are the same size, except for the border tiles. Each tile can be compressed individually. This can decrease memory usage while the program is running, but can also generate artifacts at the edges of the tiles. Artifacts generally increase as the size of the tile decreases. By default, there is one tile that contains the entire image.
The reference grid is a rectangular grid of points with the indices from (0, 0) to (Xsiz-1, Ysiz-1). An "image area" is defined on the reference grid by the dimensional parameters, (Xsiz, Ysiz) and (XOsiz, YOsiz). The various parameters defining the reference grid appear in the figures below.
Specifically, the image area on the reference grid is defined by its upper left hand reference grid point at location (XOsiz, YOsiz), and its lower right hand reference grid point at location (Xsiz-1, Ysiz-1).
Property Name | Label In Diagram |
---|---|
ImageAreaHorizontalOffset | XOsiz |
ImageAreaVerticalOffset | YOsiz |
ReferenceTileHeight | XTsiz |
ReferenceTileWidth | YTsiz |
TileHorizontalOffset | XTOsiz |
TileVerticalOffset | YTOsiz |
Progression Order
For a given tile-part, the packets contain all compressed image data from a specific layer, a specific component, a specific resolution level, and a specific precinct. The order in which these packets are found in the codestream is called the progression order. Use the CodecsJpeg2000SaveOptions.ProgressingOrder property to set the progression order. The ProgressingOrder property uses the CodecsJpeg2000ProgressionsOrder enumeration to specify the progression The ordering of the packets can progress along four axes: layer, component, resolution and position. The following progressions can be specified:
-
LayerResolutionComponentPosition. A progression of this type might be useful when low sample accuracy is most desirable, but information is needed for all components.
-
ResolutionLayerComponentPosition. A progression of this type might be useful in providing low-resolution level versions of all image components.
-
ResolutionPositionComponentLayer. A progression of this type might be useful in providing low-resolution level versions of all image components at a particular spatial location.
-
PositionComponentResolutionLayer. A progression of this type might be useful in providing high sample accuracy for a particular spatial location in all components.
-
ComponentPositionResolutionLayer. A progression of this type might be useful in providing high accuracy for a particular spatial location in a particular image component.
For more information, refer to:
System.Object
Leadtools.Codecs.CodecsJpeg2000Options
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family