Class Jpeg2000Image
- Namespace
- Aspose.Imaging.FileFormats.Jpeg2000
- Assembly
- Aspose.Imaging.dll
Efficiently manipulate JPEG2000 (JP2) image files with our API, supporting a range of bits per pixel depths and seamless processing of XMP metadata containing essential image information. With capabilities for lossless compression, ensure optimal image quality while maintaining file integrity, empowering you to tailor JP2 images to your exact specifications with ease.
public sealed class Jpeg2000Image : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
- Inheritance
-
Jpeg2000Image
- Implements
- Inherited Members
Constructors
Jpeg2000Image(RasterImage)
Instantiate a new Jpeg2000Image class with a raster image. This constructor facilitates the creation of a JPEG2000 image from an existing raster image, offering seamless integration and conversion between different image formats.
public Jpeg2000Image(RasterImage image)
Parameters
image
RasterImageThe image.
Jpeg2000Image(RasterImage, int)
Initialize a fresh Jpeg2000Image instance with a raster image and bits per pixel parameters. This constructor enables precise control over the quality and size of the resulting JPEG2000 image, making it ideal for scenarios where customization is crucial.
public Jpeg2000Image(RasterImage rasterImage, int bitsPerPixel)
Parameters
rasterImage
RasterImageThe image to initialize pixel and palette data with.
bitsPerPixel
intThe bits per pixel.
Jpeg2000Image(Stream)
Easily initialize a new instance of the Jpeg2000Image class by providing a stream object. This constructor simplifies the process of loading JPEG2000 images directly from streams, offering flexibility and convenience for handling image data from various sources.
public Jpeg2000Image(Stream stream)
Parameters
stream
StreamThe stream to load image from and initialize pixel and palette data with.
Jpeg2000Image(Stream, int)
Initialize a new instance of the Jpeg2000Image class with a stream to load the image, along with bits per pixel parameters. This constructor offers flexibility by allowing you to specify both the image data source and the desired bits per pixel, providing finer control over the image loading process.
public Jpeg2000Image(Stream stream, int bitsPerPixel)
Parameters
stream
StreamThe stream to load image from and initialize pixel and palette data with.
bitsPerPixel
intThe bits per pixel.
Jpeg2000Image(int, int)
Create a new instance of the Jpeg2000Image class, specifying the width and height parameters. This constructor allows you to initialize a JPEG2000 image with specific dimensions, which is useful for scenarios where you need to create an image of a certain size programmatically.
public Jpeg2000Image(int width, int height)
Parameters
Jpeg2000Image(int, int, Jpeg2000Options)
Instantiate a new Jpeg2000Image object, providing the width, height, and image options parameters. This constructor allows for the creation of JPEG2000 images with specific dimensions and additional options, offering flexibility in image generation.
public Jpeg2000Image(int width, int height, Jpeg2000Options options)
Parameters
width
intThe image width
height
intThe image height
options
Jpeg2000OptionsThe options.
Jpeg2000Image(int, int, int)
Create a new instance of the Jpeg2000Image class with parameters for width, height, and bits count. This constructor allows for the creation of JPEG2000 images with specific dimensions and bit depths, providing flexibility for various imaging needs.
public Jpeg2000Image(int width, int height, int bitsCount)
Parameters
Jpeg2000Image(string)
Start working with the Jpeg2000Image class by initializing a new instance with the path to the image you want to load. This constructor enables easy access to JPEG2000 images, simplifying the process of loading and handling image files. By providing the file path, you can quickly begin processing and manipulating JPEG2000 images in your application.
public Jpeg2000Image(string path)
Parameters
path
stringThe path to load image from and initialize pixel and palette data with.
Jpeg2000Image(string, int)
Get started easily with the Jpeg2000Image class by creating a new instance with both the file path and the desired bits per pixel parameter. This constructor allows for fine-tuning the image loading process, ensuring compatibility with various image formats and quality settings. With this flexibility, you can efficiently manage and manipulate JPEG2000 images according to your specific requirements.
public Jpeg2000Image(string path, int bitsPerPixel)
Parameters
path
stringThe path to load image from and initialize pixel and palette data with
bitsPerPixel
intThe bits per pixel.
Properties
BitsPerPixel
This property returns the depth of the image, measured in bits per pixel (bpp). It indicates the amount of color information stored in each pixel of the image. Understanding the image depth is crucial for determining the color fidelity and quality of the image. With this information, users can gauge the level of detail and richness of colors present in the image.
public override int BitsPerPixel { get; }
Property Value
Codec
This property retrieves the JPEG2000 codec associated with the image. The JPEG2000 codec is responsible for encoding and decoding the image data in the JPEG2000 format, providing efficient compression while maintaining high image quality. Accessing this codec can be useful for performing advanced image processing operations or optimizing image compression settings tailored to specific requirements.
public Jpeg2000Codec Codec { get; }
Property Value
- Jpeg2000Codec
The codec.
Comments
This property allows for retrieving or updating the comments associated with the image. Comments provide additional information about the image content, such as annotations, descriptions, or metadata. Modifying these comments can be useful for organizing and categorizing images, as well as conveying important details to viewers or users.
public string[] Comments { get; set; }
Property Value
- string[]
The comments.
FileFormat
Retrieve the format of the image file. This property provides information about the file format of the image. Utilize this property to determine the format of the image file programmatically, facilitating appropriate handling and processing based on the file's format.
public override FileFormat FileFormat { get; }
Property Value
Height
This property retrieves the height of the image in pixels. It serves as essential information for understanding the image's vertical dimensions, aiding in various image manipulation tasks like resizing, cropping, and rendering. Accessing this property allows users to ascertain the image's vertical size, enabling precise layout and display in applications.
public override int Height { get; }
Property Value
HorizontalResolution
This property allows you to retrieve or modify the horizontal resolution of the RasterImage, measured in pixels per inch (PPI). Adjusting this resolution can impact the size and quality of the image when printed or displayed. By setting the horizontal resolution, users can optimize the image for specific output devices or applications, ensuring the best possible visual results.
public override double HorizontalResolution { get; set; }
Property Value
- double
The horizontal resolution.
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 information about how the pixel data is stored in memory. Use this property to understand the underlying data format of the image, which can be crucial for various image processing operations like color conversion, compression, or decompression.
public override PixelDataFormat RawDataFormat { get; }
Property Value
- PixelDataFormat
The raw data format.
RawLineSize
This property retrieves the size of a single line of raw image data in bytes. It indicates the amount of memory occupied by a single row of pixels in the image's raw data format. Understanding the raw line size is essential for tasks such as memory allocation, data manipulation, and image processing algorithms that operate on individual image lines.
public override int RawLineSize { get; }
Property Value
- int
The raw line size in bytes.
VerticalResolution
This property provides access to the vertical resolution of the RasterImage, measured in pixels per inch (PPI). Modifying this resolution can affect the quality and size of the image when printed or displayed. By adjusting the vertical resolution, users can optimize the image for different output devices or applications, ensuring optimal visual rendering.
public override double VerticalResolution { get; set; }
Property Value
- double
The vertical resolution.
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 fundamental piece of information about the image's dimensions, crucial for various image processing tasks, including resizing, cropping, and rendering.
public override int Width { get; }
Property Value
XmpData
Retrieve or modify the XMP metadata associated with the image. This property grants access to the Extensible Metadata Platform (XMP) information embedded within the image file, allowing for manipulation or extraction of metadata attributes such as author details, copyright information, and descriptive tags. Utilizing this property 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
The XMP metadata.
Methods
GetOriginalOptions()
Retrieve the image options based on the original file settings. This method is beneficial for maintaining the bit-depth and other parameters of the original image, ensuring consistency and preserving the integrity of the image data. Accessing these options facilitates seamless handling and processing of the image while retaining its original characteristics. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the Save(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 them to the Save(string, ImageOptionsBase) method as the second parameter.
public override ImageOptionsBase GetOriginalOptions()
Returns
- ImageOptionsBase
The options based on the original file settings.
SaveData(Stream)
protected override void SaveData(Stream stream)
Parameters
stream
Stream
UpdateDimensions(int, int)
protected override void UpdateDimensions(int newWidth, int newHeight)