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

NameDescription
Jpeg2000Options()Initializes a new instance of the Jpeg2000Options class.
Jpeg2000Options(jpeg_2000_options)Initializes a new instance of the Jpeg2000Options class.

Properties

NameTypeAccessDescription
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
codecJpeg2000Codecr/wGets or sets the JPEG2000 codec
commentsstring[]r/wGets or sets the Jpeg comment markers.
compression_ratiosint[]r/wGets 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.
disposedboolrGets a value indicating whether this instance is disposed.
exif_dataExifDatar/wGets or sets the Exif data.
full_frameboolr/wGets or sets a value indicating whether [full frame].
irreversibleboolr/wGets or sets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default).
keep_metadataboolr/wGets a value whether to keep original image metadata on export.
multi_page_optionsMultiPageOptionsr/wThe multipage options
paletteIColorPaletter/wGets or sets the color palette.
resolution_settingsResolutionSettingr/wGets or sets the resolution settings.
sourceSourcer/wGets or sets the source to create image in.
vector_rasterization_optionsVectorRasterizationOptionsr/wGets or sets the vector rasterization options.
xmp_dataXmpPacketWrapperr/wGets or sets the XMP metadata container.

Methods

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

ParameterTypeDescription
jpeg_2000_optionsJpeg2000OptionsThe 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

TypeDescription
ImageOptionsBaseA 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:

ParameterTypeDescription
metadataIImageMetadataFormatThe metadata.

Returns

TypeDescription
boolTrue, 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)