Jpeg2000Options Class
Summary: Create JPEG2000 (JP2) image files with our API, utilizing advanced wavelet technology
for coding lossless content. Benefit from support for various codecs, including
irreversible and lossless compression, as well as XMP metadata containers, ensuring
versatility and high-quality image creation tailored to your needs.
Module: aspose.imaging.imageoptions
Full Name: aspose.imaging.imageoptions.Jpeg2000Options
Inheritance: IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, ImageOptionsBase
Constructors
| Name | Description |
|---|---|
| Jpeg2000Options() | Initializes a new instance of the Jpeg2000Options class. |
| Jpeg2000Options(jpeg_2000_options) | Initializes a new instance of the Jpeg2000Options class. |
Properties
| Name | Type | Access | Description |
|---|---|---|---|
| buffer_size_hint | int | r/w | Gets or sets the buffer size hint which is defined max allowed size for all internal buffers. |
| codec | Jpeg2000Codec | r/w | Gets or sets the JPEG2000 codec |
| comments | string[] | r/w | Gets or sets the Jpeg comment markers. |
| compression_ratios | int[] | r/w | Gets or sets the Array of compression ratio. Different compression ratios for successive layers. The rate specified for each quality level is the desired compression factor. Decreasing ratios required. |
| disposed | bool | r | Gets a value indicating whether this instance is disposed. |
| exif_data | ExifData | r/w | Gets or sets the Exif data. |
| full_frame | bool | r/w | Gets or sets a value indicating whether [full frame]. |
| irreversible | bool | r/w | Gets or sets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default). |
| keep_metadata | bool | r/w | Gets a value whether to keep original image metadata on export. |
| multi_page_options | MultiPageOptions | r/w | The multipage options |
| palette | IColorPalette | r/w | Gets or sets the color palette. |
| resolution_settings | ResolutionSetting | r/w | Gets or sets the resolution settings. |
| source | Source | r/w | Gets or sets the source to create image in. |
| vector_rasterization_options | VectorRasterizationOptions | r/w | Gets or sets the vector rasterization options. |
| xmp_data | XmpPacketWrapper | r/w | Gets or sets the XMP metadata container. |
Methods
| Name | Description |
|---|---|
| clone() | Creates a memberwise clone of this instance. |
| try_set_metadata(metadata) | Tries to set a metadata instance, if this Image instance supports and implements IImageMetadataFormat instance. |
Constructor: Jpeg2000Options()
Jpeg2000Options()
Initializes a new instance of the Jpeg2000Options class.
Constructor: Jpeg2000Options(jpeg_2000_options)
Jpeg2000Options(jpeg_2000_options)
Initializes a new instance of the Jpeg2000Options class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| jpeg_2000_options | Jpeg2000Options | The Jpeg2000 file format options to copy settings from. |
Property: codec
Gets or sets the JPEG2000 codec
See also:
Example # 1: This example shows how to create a JPEG2000 image with the desired options an…
Example # 2: This example shows how to create a PNG image and save it to JPEG2000 with the…
Property: irreversible
Gets or sets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default).
See also:
Example # 1: This example shows how to create a JPEG2000 image with the desired options an…
Example # 2: This example shows how to create a PNG image and save it to JPEG2000 with the…
Method: clone()
clone()
Creates a memberwise clone of this instance.
Returns
| Type | Description |
|---|---|
| ImageOptionsBase | A memberwise clone of this instance. |
Method: try_set_metadata(metadata)
try_set_metadata(metadata)
Tries to set a metadata instance, if this Image instance supports and implements IImageMetadataFormat instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| metadata | IImageMetadataFormat | The metadata. |
Returns
| Type | Description |
|---|---|
| bool | True, if the IMetadataContainer instance supports and/or implements IImageMetadataFormat instance; otherwise, false. |
Examples
This example shows how to create a JPEG2000 image with the desired options and save it to a file.
from aspose.imaging import Graphics, Color
from aspose.imaging.brushes import SolidBrush
from aspose.imaging.imageoptions import Jpeg2000Options
from aspose.imaging.fileformats.jpeg2000 import Jpeg2000Codec, Jpeg2000Image
from os.path import join as path_join
dir_ = "c:\\temp"
create_options = Jpeg2000Options()
# Use the irreversible Discrete Wavelet Transform 9-7
create_options.irreversible = True
# JP2 is the "container" format for JPEG 2000 codestreams.
# J2K is raw compressed data, without a wrapper.
create_options.codec = Jpeg2000Codec.J2K
# Create a JPEG2000 image of 100x100 px.
with Jpeg2000Image(100, 100, create_options) as jpeg2000_image:
graphics = Graphics(jpeg2000_image)
# Fill the entire image in red.
brush = SolidBrush(Color.red)
graphics.fill_rectangle(brush, jpeg2000_image.bounds)
# Save to a file
jpeg2000_image.save(path_join(dir_, "sample.output.j2k"))
This example shows how to create a PNG image and save it to JPEG2000 with the desired options.
from aspose.imaging import Graphics, Color
from aspose.imaging.brushes import SolidBrush
from aspose.imaging.imageoptions import Jpeg2000Options
from aspose.imaging.fileformats.jpeg2000 import Jpeg2000Codec
from aspose.imaging.fileformats.png import PngImage
from os.path import join as path_join
dir_ = "c:\\temp"
# Create a PNG image of 100x100 px.
with PngImage(100, 100) as png_image:
graphics = Graphics(png_image)
# Fill the entire image in red.
brush = SolidBrush(Color.red)
graphics.fill_rectangle(brush, png_image.bounds)
save_options = Jpeg2000Options()
# Use the irreversible Discrete Wavelet Transform 9-7
save_options.irreversible = True
# JP2 is the "container" format for JPEG 2000 codestreams.
# J2K is raw compressed data, without a wrapper.
save_options.codec = Jpeg2000Codec.J2K
# Save to a file
png_image.save(path_join(dir_, "output.j2k"), save_options)