Jpeg2000Image Constructor (RasterImage)
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(
	RasterImage image
)

Parameters

image
Type: Aspose.ImagingRasterImage
The image.
Examples
This example shows how to create a JPEG2000 image with from another raster image.
[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);

    // Create a JPEG2000 image based on the PNG image.
    using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(pngImage))
    {
        // Save to a file
        jpeg2000Image.Save(dir + "output.jp2", new Aspose.Imaging.ImageOptions.Jpeg2000Options());
    }
}
See Also