Jpeg2000Image

Jpeg2000Image class

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

Constructors

NameDescription
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.
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.
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.
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.
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.
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.
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.
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.
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.

Properties

NameDescription
AutoAdjustPalette { get; set; }Gets or sets a value indicating whether automatic adjust palette.
virtual BackgroundColor { get; set; }Gets or sets a value for the background color.
override BitsPerPixel { get; }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.
Bounds { get; }Gets the image bounds.
BufferSizeHint { get; set; }Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
Codec { get; }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.
Comments { get; set; }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.
Container { get; }Gets the Image container.
DataStreamContainer { get; }Gets the object’s data stream.
Disposed { get; }Gets a value indicating whether this instance is disposed.
override FileFormat { get; }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.
virtual HasAlpha { get; }Gets a value indicating whether this instance has alpha.
virtual HasBackgroundColor { get; set; }Gets or sets a value indicating whether image has background color.
virtual HasTransparentColor { get; set; }Gets a value indicating whether image has transparent color.
override Height { get; }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.
override HorizontalResolution { get; set; }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.
virtual ImageOpacity { get; }Gets opacity of this image.
InterruptMonitor { get; set; }Gets or sets the interrupt monitor.
override IsCached { get; }Gets a value indicating whether image data is cached currently.
IsRawDataAvailable { get; }Gets a value indicating whether raw data loading is available.
Palette { get; set; }Gets or sets the color palette. The color palette is not used when pixels are represented directly.
virtual PremultiplyComponents { get; set; }Gets or sets a value indicating whether the image components must be premultiplied.
RawCustomColorConverter { get; set; }Gets or sets the custom color converter
override RawDataFormat { get; }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.
RawDataSettings { get; }Gets the current raw data settings. Note when using these settings the data loads without conversion.
RawFallbackIndex { get; set; }Gets or sets the fallback index to use when palette index is out of bounds
RawIndexedColorConverter { get; set; }Gets or sets the indexed color converter
override RawLineSize { get; }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.
Size { get; }Gets the image size.
virtual TransparentColor { get; set; }Gets the image transparent color.
virtual UpdateXmpData { get; set; }Gets or sets a value indicating whether to update the XMP metadata.
override UsePalette { get; }Gets a value indicating whether the image palette is used.
virtual UseRawData { get; set; }Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
override VerticalResolution { get; set; }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.
override Width { get; }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.
override XmpData { get; set; }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.

Methods

NameDescription
override AdjustBrightness(int)Adjust of a brightness for image.
override AdjustContrast(float)Image contrasting
override AdjustGamma(float)Gamma-correction of an image.
override AdjustGamma(float, float, float)Gamma-correction of an image.
override BinarizeBradley(double)Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
override BinarizeBradley(double, int)Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
override BinarizeFixed(byte)Binarization of an image with predefined threshold
override BinarizeOtsu()Binarization of an image with Otsu thresholding
Blend(Point, RasterImage, byte)Blends this image instance with the overlay image.
override Blend(Point, RasterImage, Rectangle, byte)Blends this image instance with the overlay image.
override CacheData()Caches the data and ensures no additional data loading will be performed from the underlying DataStreamContainer.
CanSave(ImageOptionsBase)Determines whether image can be saved to the specified file format represented by the passed save options.
override Crop(Rectangle)Cropping the image.
virtual Crop(int, int, int, int)Crop image with shifts.
Dispose()Disposes the current instance.
Dither(DitheringMethod, int)Performs dithering on the current image.
override Dither(DitheringMethod, int, IColorPalette)Performs dithering on the current image.
virtual Filter(Rectangle, FilterOptionsBase)Filters the specified rectangle.
GetArgb32Pixel(int, int)Gets an image 32-bit ARGB pixel.
GetDefaultArgb32Pixels(Rectangle)Gets the default 32-bit ARGB pixels array.
virtual GetDefaultOptions(object[])Gets the default options.
GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader)Gets the default pixels array using partial pixel loader.
GetDefaultRawData(Rectangle, RawDataSettings)Gets the default raw data array.
GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings)Gets the default raw data array using partial pixel loader.
virtual GetModifyDate(bool)Gets the date and time the resource image was last modified.
override 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 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 method as the second parameter.
GetPixel(int, int)Gets an image pixel.
virtual GetSerializedStream(ImageOptionsBase, Rectangle, out int)Converts to aps.
GetSkewAngle()Gets the skew angle. This method is applicable to scanned text documents, to determine the skew angle when scanning.
override Grayscale()Transformation of an image to its grayscale representation
LoadArgb32Pixels(Rectangle)Loads 32-bit ARGB pixels.
LoadArgb64Pixels(Rectangle)Loads 64-bit ARGB pixels.
LoadCmyk32Pixels(Rectangle)Loads pixels in CMYK format.
LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader)Loads 32-bit ARGB pixels partially by packs.
LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader)Loads 64-bit ARGB pixels partially by packs.
LoadPartialPixels(Rectangle, IPartialPixelLoader)Loads pixels partially by packs.
LoadPixels(Rectangle)Loads pixels.
LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader)Loads raw data.
LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader)Loads raw data.
NormalizeAngle()Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses GetSkewAngle and Rotate methods.
virtual NormalizeAngle(bool, Color)Normalizes the angle. This method is applicable to scanned text documents to get rid of the skewed scan. This method uses GetSkewAngle and Rotate methods.
ReadArgb32ScanLine(int)Reads the whole scan line by the specified scan line index.
ReadScanLine(int)Reads the whole scan line by the specified scan line index.
ReplaceColor(Color, byte, Color)Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
virtual ReplaceColor(int, byte, int)Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
ReplaceNonTransparentColors(Color)Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
virtual ReplaceNonTransparentColors(int)Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
Resize(int, int)Resizes the image. The default NearestNeighbourResample is used.
override Resize(int, int, ImageResizeSettings)Resizes the image.
override Resize(int, int, ResizeType)Resizes the image.
ResizeHeightProportionally(int)Resizes the height proportionally. The default NearestNeighbourResample is used.
virtual ResizeHeightProportionally(int, ImageResizeSettings)Resizes the height proportionally.
virtual ResizeHeightProportionally(int, ResizeType)Resizes the height proportionally.
ResizeWidthProportionally(int)Resizes the width proportionally. The default NearestNeighbourResample is used.
virtual ResizeWidthProportionally(int, ImageResizeSettings)Resizes the width proportionally.
virtual ResizeWidthProportionally(int, ResizeType)Resizes the width proportionally.
virtual Rotate(float)Rotate image around the center.
override Rotate(float, bool, Color)Rotate image around the center.
override RotateFlip(RotateFlipType)Rotates, flips, or rotates and flips the image.
Save()Saves the image data to the underlying stream.
Save(Stream)Saves the object’s data to the specified stream.
override Save(string)Saves the image to the specified file location.
Save(Stream, ImageOptionsBase)Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, bool)Saves the object’s data to the specified file location.
virtual Save(string, ImageOptionsBase)Saves the object’s data to the specified file location in the specified file format according to save options.
override Save(Stream, ImageOptionsBase, Rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, ImageOptionsBase, Rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
SaveArgb32Pixels(Rectangle, int[])Saves the 32-bit ARGB pixels.
SaveCmyk32Pixels(Rectangle, int[])Saves the pixels.
SavePixels(Rectangle, Color[])Saves the pixels.
SaveRawData(byte[], int, Rectangle, RawDataSettings)Saves the raw data.
SetArgb32Pixel(int, int, int)Sets an image 32-bit ARGB pixel for the specified position.
override SetPalette(IColorPalette, bool)Sets the image palette.
SetPixel(int, int, Color)Sets an image pixel for the specified position.
virtual SetResolution(double, double)Sets the resolution for this RasterImage.
virtual ToBitmap()Converts raster image to the bitmap. This method is not supported in versions from .Net7.0 and higher
WriteArgb32ScanLine(int, int[])Writes the whole scan line to the specified scan line index.
WriteScanLine(int, Color[])Writes the whole scan line to the specified scan line index.

Examples

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

[C#]

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

// Load a JPEG2000 image.
using (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = new Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image(dir + "sample.jp2"))
{
    // Save to PNG
    jpeg2000Image.Save(dir + "sample.output.png", new Aspose.Imaging.ImageOptions.PngOptions());
}

See Also