Class Jpeg2000Image

Class Jpeg2000Image

Namespace: Aspose.Imaging.FileFormats.Jpeg2000
Assembly: Aspose.Imaging.dll (25.7.0)

Efficiently manipulate JPEG2000 (JP2) image files with our API, supportinga range of bits per pixel depths and seamless processing of XMP metadatacontaining essential image information. With capabilities for lossless compression,ensure optimal image quality while maintaining file integrity, empowering you totailor JP2 images to your exact specifications with ease.

[JsonObject(MemberSerialization.OptIn)]
   public sealed class Jpeg2000Image : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
   {
   }

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage Jpeg2000Image

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

Inherited Members

RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.IsCached , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

This example shows how to load a JPEG2000 image from a file and save it to PNG.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(dir + "sample.jp2"))
   {
       jpeg2000Image.Save(dir + "sample.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
   }

Constructors

Jpeg2000Image(string)

Start working with the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class by initializing a newinstance with the path to the image you want to load. This constructor enables easyaccess to JPEG2000 images, simplifying the process of loading and handling imagefiles. By providing the file path, you can quickly begin processing andmanipulating JPEG2000 images in your application.

public Jpeg2000Image(string path)
   {
   }

Parameters

path string

The path to load image from and initialize pixel and palette data with.

Examples

This example shows how to load a JPEG2000 image from a file and save it to PNG.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(dir + "sample.jp2"))
   {
       jpeg2000Image.Save(dir + "sample.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
   }

Jpeg2000Image(string, int)

Get started easily with the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class by creating a newinstance with both the file path and the desired bits per pixel parameter. Thisconstructor allows for fine-tuning the image loading process, ensuringcompatibility with various image formats and quality settings. With thisflexibility, you can efficiently manage and manipulate JPEG2000 images according toyour specific requirements.

public Jpeg2000Image(string path, int bitsPerPixel)
   {
   }

Parameters

path string

The path to load image from and initialize pixel and palette data with

bitsPerPixel int

The bits per pixel.

Jpeg2000Image(Stream)

Easily initialize a new instance of the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class byproviding a stream object. This constructor simplifies the process of loadingJPEG2000 images directly from streams, offering flexibility and convenience forhandling image data from various sources.

public Jpeg2000Image(Stream stream)
   {
   }

Parameters

stream Stream

The stream to load image from and initialize pixel and palette data with.

Examples

This example shows how to load a JPEG2000 image from a file stream and save it to PNG.

string dir = "c:\\temp\\";
   using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.jp2"))
   {
       using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(stream))
       {
           jpeg2000Image.Save(dir + "sample.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
       }
   }

Jpeg2000Image(Stream, int)

Initialize a new instance of the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class with a stream toload the image, along with bits per pixel parameters. This constructor offersflexibility by allowing you to specify both the image data source and the desiredbits per pixel, providing finer control over the image loading process.

public Jpeg2000Image(Stream stream, int bitsPerPixel)
   {
   }

Parameters

stream Stream

The stream to load image from and initialize pixel and palette data with.

bitsPerPixel int

The bits per pixel.

Jpeg2000Image(int, int)

Create a new instance of the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class, specifying thewidth and height parameters. This constructor allows you to initialize a JPEG2000image with specific dimensions, which is useful for scenarios where you need tocreate an image of a certain size programmatically.

public Jpeg2000Image(int width, int height)
   {
   }

Parameters

width int

The image width

height int

The image height

Examples

This example shows how to create a JPEG2000 image and save it to a file.

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

Jpeg2000Image(int, int, Jpeg2000Options)

Instantiate a new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image object, providing the width, height,and image options parameters. This constructor allows for the creation of JPEG2000images with specific dimensions and additional options, offering flexibility inimage generation.

public Jpeg2000Image(int width, int height, Jpeg2000Options options)
   {
   }

Parameters

width int

The image width

height int

The image height

options Jpeg2000Options

The options.

Examples

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

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
   {
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
       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();
       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");
   }

Jpeg2000Image(int, int, int)

Create a new instance of the Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class with parameters forwidth, height, and bits count. This constructor allows for the creation of JPEG2000images with specific dimensions and bit depths, providing flexibility for variousimaging needs.

public Jpeg2000Image(int width, int height, int bitsCount)
   {
   }

Parameters

width int

The image width

height int

The image height

bitsCount int

The bits count.

Jpeg2000Image(RasterImage)

Instantiate a new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image class with a raster image. Thisconstructor facilitates the creation of a JPEG2000 image from an existing rasterimage, offering seamless integration and conversion between different image formats.

public Jpeg2000Image(RasterImage image)
{
}

Parameters

image RasterImage

The image.

Examples

This example shows how to create a JPEG2000 image with from another raster image.

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);
       using (var jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(pngImage))
       {
           jpeg2000Image.Save(dir + "output.jp2", new Aspose.Imaging.ImageOptions.Jpeg2000Options());
       }
   }

Jpeg2000Image(RasterImage, int)

Initialize a fresh Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image instance with a raster image andbits per pixel parameters. This constructor enables precise control over thequality and size of the resulting JPEG2000 image, making it ideal for scenarioswhere customization is crucial.

public Jpeg2000Image(RasterImage rasterImage, int bitsPerPixel)
   {
   }

Parameters

rasterImage RasterImage

The image to initialize pixel and palette data with.

bitsPerPixel int

The bits per pixel.

Properties

BitsPerPixel

This property returns the depth of the image, measured in bits per pixel (bpp). Itindicates the amount of color information stored in each pixel of the image.Understanding the image depth is crucial for determining the color fidelity andquality of the image. With this information, users can gauge the level of detailand richness of colors present in the image.

public override int BitsPerPixel
    {
        get;
    }

Property Value

int

Codec

This property retrieves the JPEG2000 codec associated with the image. The JPEG2000codec is responsible for encoding and decoding the image data in the JPEG2000format, providing efficient compression while maintaining high image quality.Accessing this codec can be useful for performing advanced image processingoperations or optimizing image compression settings tailored to specific requirements.

public Jpeg2000Codec Codec
   {
      get;
   }

Property Value

Jpeg2000Codec

Comments

This property allows for retrieving or updating the comments associated with theimage. Comments provide additional information about the image content, such asannotations, descriptions, or metadata. Modifying these comments can be useful fororganizing and categorizing images, as well as conveying important details toviewers or users.

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

Property Value

string []

FileFormat

Retrieve the format of the image file. This property provides information about thefile format of the image. Utilize this property to determine the format of theimage file programmatically, facilitating appropriate handling and processing basedon the file’s format.

public override FileFormat
    Get
    {
        get;
    }

Property Value

FileFormat

Height

This property retrieves the height of the image in pixels. It serves as essentialinformation for understanding the image’s vertical dimensions, aiding in variousimage manipulation tasks like resizing, cropping, and rendering. Accessing thisproperty allows users to ascertain the image’s vertical size, enabling preciselayout and display in applications.

public override int Height
   {
      get;
   }

Property Value

int

HorizontalResolution

This property allows you to retrieve or modify the horizontal resolution of theAspose.Imaging.RasterImage, measured in pixels per inch (PPI). Adjusting thisresolution can impact the size and quality of the image when printed or displayed.By setting the horizontal resolution, users can optimize the image for specificoutput devices or applications, ensuring the best possible visual results.

public override double
    HorizontalResolution
    {
        get;
        set;
    }

Property Value

double

Examples

The following example shows how to set horizontal/vertical resolution of a JPEG2000 image.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jp2"))
   {
       Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image)image;
       double horizontalResolution = jpeg2000Image.HorizontalResolution;
       double verticalResolution = jpeg2000Image.VerticalResolution;
       System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
       System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
       if (horizontalResolution != 96.0 || verticalResolution != 96.0)
       {
           System.Console.WriteLine("Set resolution values to 96 dpi");
           jpeg2000Image.SetResolution(96.0, 96.0);
           System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpeg2000Image.HorizontalResolution);
           System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpeg2000Image.VerticalResolution);
       }
   }

Remarks

Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

RawDataFormat

This property retrieves the raw data format of the image. It provides informationabout how the pixel data is stored in memory. Use this property to understand theunderlying data format of the image, which can be crucial for various imageprocessing operations like color conversion, compression, or decompression.

public override PixelDataFormat RawDataFormat
   {
      get;
   }

Property Value

PixelDataFormat

RawLineSize

This property retrieves the size of a single line of raw image data in bytes. Itindicates the amount of memory occupied by a single row of pixels in the image’sraw data format. Understanding the raw line size is essential for tasks such asmemory allocation, data manipulation, and image processing algorithms that operateon individual image lines.

public override int RawLineSize
   {
      get;
   }

Property Value

int

VerticalResolution

This property provides access to the vertical resolution of theAspose.Imaging.RasterImage, measured in pixels per inch (PPI). Modifying thisresolution can affect the quality and size of the image when printed or displayed.By adjusting the vertical resolution, users can optimize the image for differentoutput devices or applications, ensuring optimal visual rendering.

public override double VerticalResolution
    {
        get;
        set;
    }

Property Value

double

Examples

The following example shows how to set horizontal/vertical resolution of a JPEG2000 image.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jp2"))
   {
      Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image)image;
      double horizontalResolution = jpeg2000Image.HorizontalResolution;
      double verticalResolution = jpeg2000Image.VerticalResolution;
      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
      if (horizontalResolution != 96.0 || verticalResolution != 96.0)
      {
         System.Console.WriteLine("Set resolution values to 96 dpi");
         jpeg2000Image.SetResolution(96.0, 96.0);
         System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpeg2000Image.HorizontalResolution);
         System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpeg2000Image.VerticalResolution);
      }
   }

Remarks

Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

Width

This property returns the width of the image in pixels. It provides a fundamentalpiece of information about the image’s dimensions, crucial for various imageprocessing tasks, including resizing, cropping, and rendering.

public override int Width
    {
        get;
    }

Property Value

int

XmpData

Retrieve or modify the XMP metadata associated with the image. This property grantsaccess to the Extensible Metadata Platform (XMP) information embedded within theimage file, allowing for manipulation or extraction of metadata attributes such asauthor details, copyright information, and descriptive tags. Utilizing thisproperty empowers you to manage and leverage metadata embedded within the image,enhancing interoperability and metadata-driven workflows in your image processing tasks.

public override XmpPacketWrapper XmpData
    {
        get;
        set;
    }

Property Value

XmpPacketWrapper

Methods

GetOriginalOptions()

Retrieve the image options based on the original file settings. This method isbeneficial for maintaining the bit-depth and other parameters of the originalimage, ensuring consistency and preserving the integrity of the image data.Accessing these options facilitates seamless handling and processing of the imagewhile retaining its original characteristics.For example, if we load a black-white PNG image with 1 bit per pixel and then save it using theAspose.Imaging.DataStreamSupporter.Save(System.String) method, the output PNG image with 8-bit per pixel will be produced.To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass themto the Aspose.Imaging.Image.Save(System.String,Aspose.Imaging.ImageOptionsBase) method as the second parameter.

public override ImageOptionsBase GetOriginalOptions()
{
}
In this case, no changes are needed as the given code already adheres to standard C# conventions for indentation and spacing. However, if there were any multiline statements within the method body, they would be properly indented and formatted accordingly.

Returns

ImageOptionsBase

The options based on the original file settings.

SaveData(Stream)

Saves the data.

protected override void SaveData(Stream stream)
   {
   }

Parameters

stream Stream

The stream to save data to.

UpdateDimensions(int, int)

Updates the image dimensions.

protected override void UpdateDimensions(
       int newWidth,
       int newHeight
   )
{
}

Parameters

newWidth int

The new image width.

newHeight int

The new image height.

 English