JpegOptions Class

Summary: Create high-quality JPEG images effortlessly with our API, offering adjustable
levels of compression to optimize storage size without compromising image quality.
Benefit from support for various compression types, near lossless coding,
RGB and CMYK color profiles, as well as EXIF, JFIF image data, and XMP
containers, ensuring versatile and customizable options for your image creation needs.

Module: aspose.imaging.imageoptions

Full Name: aspose.imaging.imageoptions.JpegOptions

Inheritance: ImageOptionsBase

Aspose.Imaging Version: 24.5.0

Constructors

NameDescription
JpegOptions()Initializes a new instance of the JpegOptions class.
JpegOptions(jpeg_options)Initializes a new instance of the JpegOptions class.

Properties

NameTypeAccessDescription
bits_per_channelbyter/wGets or sets bits per channel for lossless jpeg image. Now we support from 2 to 8 bits per channel.
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
cmyk_color_profileStreamSourcer/wThe destination CMYK color profile for CMYK jpeg images. Use for saving images. Must be in pair with RGBColorProfile for correct color conversion.
color_typeJpegCompressionColorModer/wGets or sets the color type for jpeg image.
commentstringr/wGets or sets the jpeg file comment.
compression_typeJpegCompressionModer/wGets or sets the compression type.
default_memory_allocation_limitintr/wGets or sets the default memory allocation limit.
disposedboolrGets a value indicating whether this instance is disposed.
exif_dataJpegExifDatar/wGet or set exif data container
full_frameboolr/wGets or sets a value indicating whether [full frame].
horizontal_samplingbyter/wGets or sets the horizontal subsamplings for each component.
jfifJFIFDatar/wGets or sets the jfif.
jpeg_ls_allowed_lossy_errorintr/wGets or sets the JPEG-LS difference bound for near-lossless coding (NEAR parameter from the JPEG-LS specification).
jpeg_ls_interleave_modeJpegLsInterleaveModer/wGets or sets the JPEG-LS interleave mode.
jpeg_ls_presetJpegLsPresetCodingParametersr/wGets or sets the JPEG-LS preset parameters.
multi_page_optionsMultiPageOptionsr/wThe multipage options
paletteIColorPaletter/wGets or sets the color palette.
preblend_alpha_if_presentboolr/wGets or sets a value indicating whether red, green and blue components should be mixed with a background color, if alpha channel is present.
qualityintr/wGets or sets image quality.
rd_opt_settingsRdOptimizerSettingsr/wGets or sets the RD optimizer settings.
resolution_settingsResolutionSettingr/wGets or sets the resolution settings.
resolution_unitResolutionUnitr/wGets or sets the resolution unit.
rgb_color_profileStreamSourcer/wThe destination RGB color profile for CMYK jpeg images. Use for saving images. Must be in pair with CMYKColorProfile for correct color conversion.
sample_rounding_modeSampleRoundingModer/wGets or sets the sample rounding mode to fit an 8-bit value to an n-bit value. JpegOptions.BitsPerChannel
scaled_qualityintrThe scaled quality.
sourceSourcer/wGets or sets the source to create image in.
vector_rasterization_optionsVectorRasterizationOptionsr/wGets or sets the vector rasterization options.
vertical_samplingbyter/wGets or sets the vertical subsamplings for each component.
xmp_dataXmpPacketWrapperr/wGets or sets the XMP metadata container.

Methods

NameDescription
clone()Clones this instance.

Constructor: JpegOptions()

 JpegOptions() 

Initializes a new instance of the JpegOptions class.

Constructor: JpegOptions(jpeg_options)

 JpegOptions(jpeg_options) 

Initializes a new instance of the JpegOptions class.

Parameters:

ParameterTypeDescription
jpeg_optionsJpegOptionsThe JPEG options.

Method: clone()

 clone() 

Clones this instance.

Returns

TypeDescription
ImageOptionsBaseReturns shallow copy of this instance

Examples

This example demonstrates the use of different classes from imageoptions package for export purposes. A gif image is loaded as an instance of Image and then exported out to several formats.


from aspose.imaging import Image
from aspose.imaging.imageoptions import BmpOptions, JpegOptions, PngOptions, TiffOptions
from aspose.imaging.fileformats.tiff.enums import TiffExpectedFormat
from os.path import join as path_join

directory = "c:\\temp\\"
#Load an existing gif image as an instance of Image class
with Image.load(path_join(directory, "sample.gif")) as image:
	# Export to BMP file format using the default options
	image.save(path_join(directory, "output.bmp"), BmpOptions())
	# Export to JPEG file format using the default options
	image.save(path_join(directory, "output.jpg"), JpegOptions())
	# Export to PNG file format using the default options
	image.save(path_join(directory, "output.png"), PngOptions())
	# Export to TIFF file format using the default options
	image.save(path_join(directory, "output.tif"), TiffOptions(TiffExpectedFormat.DEFAULT))