Class Jpeg2000Options

Class Jpeg2000Options

Namespace: Aspose.Imaging.ImageOptions
Assembly: Aspose.Imaging.dll (25.7.0)

Create JPEG2000 (JP2) image files with our API, utilizing advanced wavelet technologyfor coding lossless content. Benefit from support for various codecs, includingirreversible and lossless compression, as well as XMP metadata containers, ensuringversatility and high-quality image creation tailored to your needs.

public class Jpeg2000Options : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata, ICloneable
   {
   }
In the above output, the original structure of the code remains intact. The indentation has been properly adjusted to conform to standard C# conventions.

Inheritance

object DisposableObject ImageOptionsBase Jpeg2000Options

Implements

IDisposable , IHasXmpData , IHasMetadata , ICloneable

Inherited Members

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

The following example shows how to convert a multipage vector image to JPEG 2000 format in general way without referencing to a particular image type.

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
   string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
   string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.j2k");
   Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
   {
       exportOptions.MultiPageOptions = null;
       if (image is Aspose.Imaging.IMultipageImage multipageImage && multipageImage.Pages != null && multipageImage.PageCount > 2)
       {
           exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
       }
       if (image is Aspose.Imaging.VectorImage)
       {
           exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
           exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
           exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
       }
       image.Save(outputFilePath, exportOptions);
   }

Constructors

Jpeg2000Options()

Initializes a new instance of the Aspose.Imaging.ImageOptions.Jpeg2000Options class.

public Jpeg2000Options()
   {
   }

Jpeg2000Options(Jpeg2000Options)

Initializes a new instance of the Aspose.Imaging.ImageOptions.Jpeg2000Options class.

public Jpeg2000Options(Jpeg2000Options jpeg2000Options)
   {
   }

Parameters

jpeg2000Options Jpeg2000Options

The Jpeg2000 file format options to copy settings from.

Properties

Codec

Gets or sets the JPEG2000 codec

public Jpeg2000Codec Codec
   {
      get;
      set;
   }

Property Value

Jpeg2000Codec

Examples

This example shows how to create a PNG image and save it to JPEG2000 with the desired options.

string dir = "c:\\temp\\";
   using (var pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
   {
       var graphics = new Aspose.Imaging.Graphics(pngImage);
       var brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
       graphics.FillRectangle(brush, pngImage.Bounds);
       var saveOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
       saveOptions.Irreversible = true;
       saveOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;
       pngImage.Save(dir + "output.j2k", saveOptions);
   }

This example shows how to create a JPEG2000 image with the desired options and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.Jpeg2000Options createOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
   createOptions.Irreversible = true;
   createOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;
   using (var jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(100, 100, createOptions))
   {
       var graphics = new Aspose.Imaging.Graphics(jpeg2000Image);
       var brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
       graphics.FillRectangle(brush, jpeg2000Image.Bounds);
       jpeg2000Image.Save(dir + "sample.output.j2k");
   }

Comments

Gets or sets the Jpeg comment markers.

public string[] Comments
{
    get => this.Comments;
    set => this.Comments = value;
}

Property Value

string []

CompressionRatios

Gets or sets the Array of compression ratio.Different compression ratios for successive layers.The rate specified for each quality level is the desiredcompression factor.Decreasing ratios required.

public int[] CompressionRatios
{
    get;
    set;
}

Property Value

int []

Irreversible

Gets or sets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default).

public bool Irreversible
   {
      get;
      set;
   }

Property Value

bool

Examples

This example shows how to create a PNG image and save it to JPEG2000 with the desired options.

string dir = "c:\\temp\\";
   using (var pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
   {
       var graphics = new Aspose.Imaging.Graphics(pngImage);
       var brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
       graphics.FillRectangle(brush, pngImage.Bounds);
       var saveOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
       saveOptions.Irreversible = true;
       saveOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;
       pngImage.Save(dir + "output.j2k", saveOptions);
   }

This example shows how to create a JPEG2000 image with the desired options and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.Jpeg2000Options createOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
   createOptions.Irreversible = true;
   createOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;
   using (var jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(100, 100, createOptions))
   {
       var graphics = new Aspose.Imaging.Graphics(jpeg2000Image);
       var brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
       graphics.FillRectangle(brush, jpeg2000Image.Bounds);
       jpeg2000Image.Save(dir + "sample.output.j2k");
   }
 English