Jpeg2000Image Constructor (Int32, Int32, Jpeg2000Options)
Initializes a new instance of the Jpeg2000Image class.

Namespace: Aspose.Imaging.FileFormats.Jpeg2000
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntax
public Jpeg2000Image(
	int width,
	int height,
	Jpeg2000Options options
)

Parameters

width
Type: SystemInt32
The image width
height
Type: SystemInt32
The image height
options
Type: Aspose.Imaging.ImageOptionsJpeg2000Options
The options.
Examples
This example shows how to create a PNG image and save it to JPEG2000 with the desired options.
[C#]

string dir = "c:\\temp\\";

// Create a PNG image of 100x100 px.
using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
{
    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);

    // Fill the entire image in red.
    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
    graphics.FillRectangle(brush, pngImage.Bounds);

    Aspose.Imaging.ImageOptions.Jpeg2000Options saveOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();

    // Use the irreversible Discrete Wavelet Transform 9-7
    saveOptions.Irreversible = true;

    // JP2 is the "container" format for JPEG 2000 codestreams.
    // J2K is raw compressed data, without a wrapper.
    saveOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;

    // Save to a file
    pngImage.Save(dir + "output.j2k", saveOptions);
}
Examples
This example shows how to create a JPEG2000 image with the desired options and save it to a file.
[C#]

string dir = "c:\\temp\\";

Aspose.Imaging.ImageOptions.Jpeg2000Options createOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();

// Use the irreversible Discrete Wavelet Transform 9-7
createOptions.Irreversible = true;

// JP2 is the "container" format for JPEG 2000 codestreams.
// J2K is raw compressed data, without a wrapper.
createOptions.Codec = Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K;

// Create a JPEG2000 image of 100x100 px.
using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(100, 100, createOptions))
{
    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(jpeg2000Image);

    // Fill the entire image in red.
    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
    graphics.FillRectangle(brush, jpeg2000Image.Bounds);

    // Save to a file
    jpeg2000Image.Save(dir + "sample.output.j2k");
}
See Also