Click or drag to resize

Jp2EncoderCompression Property

Gets or sets the compression value to use when compressing an image.

Namespace:  Atalasoft.Imaging.Codec.Jpeg2000
Assembly:  Atalasoft.dotImage.Jpeg2000 (in Atalasoft.dotImage.Jpeg2000.dll) Version: 11.0.0.0.0.297 (.NET 4.5.2, x86)
Syntax
public double Compression { get; set; }

Property Value

Type: Double
The current compression value
Exceptions
ExceptionCondition
[ArgumentOutOfRangeException] Thrown if the value is less than 0 or greater than 100 ( for Jp2CompressionMode.Quality), or if the value is less than 500 (for Jp2Compression.Size).
Remarks

The value of this property can have two meanings. Choose between these with the CompressionMode property.

When used as Compression Size:

This property sets the maximum file size (in bytes) for lossy compression. In general the final size will be exactly the requested size or a few bytes lower. The minumum value is 500 bytes, which is required for hearder information.

When used as Compression Quality:

Compression may also be set to a percentage of quality (greater than 0 and less than or equal to 100). If Compression is set to 99, the image will be visually lossless. If the Compression is set to 100, the image will be numerically lossless. A value of 1 corrasponds to maximum compression, while 0 has the same effect as 100.

Examples

Visual Basic:

Imports Atalasoft.Imaging
Imports Atalasoft.Imaging.Codec
...
Dim myImage As AtalaImage = New AtalaImage("imagefile.jpg")
myImage.Save("imagefile.jp2", New Jp2Encoder(2.5), Nothing)

C#:

using Atalasoft.Imaging;
using Atalasoft.Imaging.Codec;
...
AtalaImage myImage = new AtalaImage("imagefile.jpg");
myImage.Save("imagefile.jp2", new Jp2Encoder(2.5), null);
See Also