JpegOptions Class
Contents
[
Hide
]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: IHasXmpData, IHasMetadata, IHasExifData, IHasJpegExifData, ImageOptionsBase
Constructors
Name | Description |
---|---|
JpegOptions() | Initializes a new instance of the JpegOptions class. |
JpegOptions(jpeg_options) | Initializes a new instance of the JpegOptions class. |
Properties
Name | Type | Access | Description |
---|---|---|---|
bits_per_channel | byte | r/w | Gets or sets bits per channel for lossless jpeg image. Now we support from 2 to 8 bits per channel. |
buffer_size_hint | int | r/w | Gets or sets the buffer size hint which is defined max allowed size for all internal buffers. |
cmyk_color_profile | StreamSource | r/w | The destination CMYK color profile for CMYK jpeg images. Use for saving images. Must be in pair with RGBColorProfile for correct color conversion. |
color_type | JpegCompressionColorMode | r/w | Gets or sets the color type for jpeg image. |
comment | string | r/w | Gets or sets the jpeg file comment. |
compression_type | JpegCompressionMode | r/w | Gets or sets the compression type. |
default_memory_allocation_limit | int | r/w | Gets or sets the default memory allocation limit. |
disposed | bool | r | Gets a value indicating whether this instance is disposed. |
exif_data | JpegExifData | r/w | Get or set Exif data container. |
full_frame | bool | r/w | Gets or sets a value indicating whether [full frame]. |
horizontal_sampling | byte | r/w | Gets or sets the horizontal subsamplings for each component. |
jfif | JFIFData | r/w | Gets or sets the jfif. |
jpeg_ls_allowed_lossy_error | int | r/w | Gets or sets the JPEG-LS difference bound for near-lossless coding (NEAR parameter from the JPEG-LS specification). |
jpeg_ls_interleave_mode | JpegLsInterleaveMode | r/w | Gets or sets the JPEG-LS interleave mode. |
jpeg_ls_preset | JpegLsPresetCodingParameters | r/w | Gets or sets the JPEG-LS preset parameters. |
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. |
preblend_alpha_if_present | bool | r/w | Gets or sets a value indicating whether red, green and blue components should be mixed with a background color, if alpha channel is present. |
quality | int | r/w | Gets or sets image quality. |
rd_opt_settings | RdOptimizerSettings | r/w | Gets or sets the RD optimizer settings. |
resolution_settings | ResolutionSetting | r/w | Gets or sets the resolution settings. |
resolution_unit | ResolutionUnit | r/w | Gets or sets the resolution unit. |
rgb_color_profile | StreamSource | r/w | The destination RGB color profile for CMYK jpeg images. Use for saving images. Must be in pair with CMYKColorProfile for correct color conversion. |
sample_rounding_mode | SampleRoundingMode | r/w | Gets or sets the sample rounding mode to fit an 8-bit value to an n-bit value. JpegOptions.BitsPerChannel |
scaled_quality | int | r | The scaled quality. |
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. |
vertical_sampling | byte | r/w | Gets or sets the vertical subsamplings for each component. |
xmp_data | XmpPacketWrapper | r/w | Gets or sets the XMP metadata container. |
Methods
Name | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
jpeg_options | JpegOptions | The JPEG options. |
Method: clone()
clone()
Clones this instance.
Returns
Type | Description |
---|---|
ImageOptionsBase | Returns 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))