CmxImagePage Class

Summary: The image of CMX page

Module: aspose.imaging.fileformats.cmx

Full Name: aspose.imaging.fileformats.cmx.CmxImagePage

Inheritance: IObjectWithBounds, IObjectWithSizeF, ICmxImage, VectorImage

Aspose.Imaging Version: 24.5.0

Constructors

NameDescription
CmxImagePage(cmx_page)Initializes a new instance of the CmxImagePage class.

Properties

NameTypeAccessDescription
auto_adjust_paletteboolr/wGets or sets a value indicating whether automatic adjust palette.
background_colorColorr/wGets or sets a value for the background color.
bits_per_pixelintrGets the image bits per pixel count.
boundsRectanglerGets the object bounds.
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
cmx_pageCmxPagerGets the CMX page.
containerImagerGets the Image container.
data_stream_containerStreamContainerrGets the object’s data stream.
disposedboolrGets a value indicating whether this instance is disposed.
file_formatFileFormatrGets a value of file format
has_background_colorboolr/wGets or sets a value indicating whether image has background color.
heightintrGets the image height.
height_ffloatrGets the object height, in inches.
interrupt_monitorInterruptMonitorr/wGets or sets the interrupt monitor.
is_cachedboolrGets a value indicating whether object’s data is cached currently and no data reading is required.
paletteIColorPaletter/wGets or sets the color palette. The color palette is not used when pixels are represented directly.
sizeSizerGets the object size.
size_fSizeFrGets the object size, in inches.
use_paletteboolrGets a value indicating whether the image palette is used.
widthintrGets the image width.
width_ffloatrGets the object width, in inches.

Methods

NameDescription
cache_data()Cache can not be used.
can_load(file_path)Determines whether image can be loaded from the specified file path.
can_load(file_path, load_options)Determines whether image can be loaded from the specified file path and optionally using the specified open options.
can_load(stream)Determines whether image can be loaded from the specified stream.
can_load(stream, load_options)Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.
can_load_stream(stream)Determines whether image can be loaded from the specified stream.
can_load_stream_with_options(stream, load_options)Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.
can_load_with_options(file_path, load_options)Determines whether image can be loaded from the specified file path and optionally using the specified open options.
can_save(options)Determines whether image can be saved to the specified file format represented by the passed save options.
create(image_options, width, height)Creates a new image using the specified create options.
create(images)Creates a new image using the specified images as pages
create(images, dispose_images)Creates a new image the specified images as pages.
get_default_options(args)Gets the default options.
get_embedded_images()Gets the embedded images.
get_file_format(file_path)Gets the file format.
get_file_format(stream)Gets the file format.
get_file_format_of_stream(stream)Gets the file format.
get_fitting_rectangle(rectangle, pixels, width, height)Gets rectangle which fits the current image.
get_fitting_rectangle(rectangle, width, height)Gets rectangle which fits the current image.
get_original_options()Gets the options based on the original file settings.
This can be helpful to keep bit-depth and other parameters of the original image unchanged.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
DataStreamSupporter.save(file_path) 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 Image.save(file_path, options) method as the second parameter.
get_proportional_height(width, height, new_width)Gets a proportional height.
get_proportional_width(width, height, new_height)Gets a proportional width.
get_serialized_stream(image_options, clipping_rectangle, page_number)Converts to aps.
load(file_path)Loads a new image from the specified file.
load(file_path, load_options)Loads a new image from the specified file.
load(stream)Loads a new image from the specified stream.
load(stream, load_options)Loads a new image from the specified stream.
load_stream(stream)Loads a new image from the specified stream.
load_stream_with_options(stream, load_options)Loads a new image from the specified stream.
load_with_options(file_path, load_options)Loads a new image from the specified file.
remove_background()Removes the background.
remove_background(settings)Removes the background.
resize(new_width, new_height)Resizes the image. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize(new_width, new_height, resize_type)Resizes the image.
resize(new_width, new_height, settings)Resizes the image.
resize_by_settings(new_width, new_height, settings)Resizes the image.
resize_by_type(new_width, new_height, resize_type)Resizes the image.
resize_height_proportionally(new_height)Resizes the height proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize_height_proportionally(new_height, resize_type)Resizes the height proportionally.
resize_height_proportionally(new_height, settings)Resizes the height proportionally.
resize_height_proportionally_settings(new_height, settings)Resizes the height proportionally.
resize_width_proportionally(new_width)Resizes the width proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize_width_proportionally(new_width, resize_type)Resizes the width proportionally.
resize_width_proportionally(new_width, settings)Resizes the width proportionally.
resize_width_proportionally_settings(new_width, settings)Resizes the width proportionally.
rotate_flip(rotate_flip_type)Rotates, flips, or rotates and flips the image.
save()Saves the image data to the underlying stream.
save(file_path)Saves the image to the specified file location.
save(file_path, options)Saves the object’s data to the specified file location in the specified file format according to save options.
save(file_path, options, bounds_rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
save(file_path, over_write)Saves the object’s data to the specified file location.
save(stream)Saves the data.
save(stream, options_base)Saves the image’s data to the specified stream in the specified file format according to save options.
save(stream, options_base, bounds_rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
save_to_stream(stream)Saves the object’s data to the specified stream.
save_to_stream_with_options(stream, options_base)Saves the image’s data to the specified stream in the specified file format according to save options.
save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
save_with_options(file_path, options)Saves the object’s data to the specified file location in the specified file format according to save options.
save_with_options_rect(file_path, options, bounds_rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
set_palette(palette, update_colors)Sets the image palette.

Constructor: CmxImagePage(cmx_page)

 CmxImagePage(cmx_page) 

Initializes a new instance of the CmxImagePage class.

Parameters:

ParameterTypeDescription
cmx_pageCmxPageThe CMX page.

Method: can_load(file_path) [static]

 can_load(file_path) 

Determines whether image can be loaded from the specified file path.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.

Returns

TypeDescription
booltrue if image can be loaded from the specified file; otherwise, false.

Method: can_load(file_path, load_options) [static]

 can_load(file_path, load_options) 

Determines whether image can be loaded from the specified file path and optionally using the specified open options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
booltrue if image can be loaded from the specified file; otherwise, false.

Method: can_load(stream) [static]

 can_load(stream) 

Determines whether image can be loaded from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.

Returns

TypeDescription
booltrue if image can be loaded from the specified stream; otherwise, false.

Method: can_load(stream, load_options) [static]

 can_load(stream, load_options) 

Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
booltrue if image can be loaded from the specified stream; otherwise, false.

Method: can_load_stream(stream) [static]

 can_load_stream(stream) 

Determines whether image can be loaded from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.

Returns

TypeDescription
booltrue if image can be loaded from the specified stream; otherwise, false.

Method: can_load_stream_with_options(stream, load_options) [static]

 can_load_stream_with_options(stream, load_options) 

Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
booltrue if image can be loaded from the specified stream; otherwise, false.

Method: can_load_with_options(file_path, load_options) [static]

 can_load_with_options(file_path, load_options) 

Determines whether image can be loaded from the specified file path and optionally using the specified open options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
booltrue if image can be loaded from the specified file; otherwise, false.

Method: can_save(options)

 can_save(options) 

Determines whether image can be saved to the specified file format represented by the passed save options.

Parameters:

ParameterTypeDescription
optionsImageOptionsBaseThe save options to use.

Returns

TypeDescription
booltrue if image can be saved to the specified file format represented by the passed save options; otherwise, false.

Method: create(image_options, width, height) [static]

 create(image_options, width, height) 

Creates a new image using the specified create options.

Parameters:

ParameterTypeDescription
image_optionsImageOptionsBaseThe image options.
widthintThe width.
heightintThe height.

Returns

TypeDescription
ImageThe newly created image.

Method: create(images) [static]

 create(images) 

Creates a new image using the specified images as pages

Parameters:

ParameterTypeDescription
imagesImage[]The images.

Returns

TypeDescription
ImageThe Image as IMultipageImage

Method: create(images, dispose_images) [static]

 create(images, dispose_images) 

Creates a new image the specified images as pages.

Parameters:

ParameterTypeDescription
imagesImage[]The images.
dispose_imagesboolif set to true [dispose images].

Returns

TypeDescription
ImageThe Image as IMultipageImage

Method: get_default_options(args)

 get_default_options(args) 

Gets the default options.

Parameters:

ParameterTypeDescription
argsobjectThe arguments.

Returns

TypeDescription
ImageOptionsBaseDefault options

Method: get_embedded_images()

 get_embedded_images() 

Gets the embedded images.

Returns

TypeDescription
EmbeddedImage[]Array of images

Method: get_file_format(file_path) [static]

 get_file_format(file_path) 

Gets the file format.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.

Returns

TypeDescription
FileFormatThe determined file format.

Method: get_file_format(stream) [static]

 get_file_format(stream) 

Gets the file format.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream.

Returns

TypeDescription
FileFormatThe determined file format.

Method: get_file_format_of_stream(stream) [static]

 get_file_format_of_stream(stream) 

Gets the file format.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream.

Returns

TypeDescription
FileFormatThe determined file format.

Method: get_fitting_rectangle(rectangle, pixels, width, height) [static]

 get_fitting_rectangle(rectangle, pixels, width, height) 

Gets rectangle which fits the current image.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get fitting rectangle for.
pixelsintThe 32-bit ARGB pixels.
widthintThe object width.
heightintThe object height.

Returns

TypeDescription
RectangleThe fitting rectangle or exception if no fitting rectangle can be found.

Method: get_fitting_rectangle(rectangle, width, height) [static]

 get_fitting_rectangle(rectangle, width, height) 

Gets rectangle which fits the current image.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get fitting rectangle for.
widthintThe object width.
heightintThe object height.

Returns

TypeDescription
RectangleThe fitting rectangle or exception if no fitting rectangle can be found.

Method: get_original_options()

 get_original_options() 

Gets the options based on the original file settings.
This can be helpful to keep bit-depth and other parameters of the original image unchanged.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
DataStreamSupporter.save(file_path) 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 Image.save(file_path, options) method as the second parameter.

Returns

TypeDescription
ImageOptionsBaseThe options based on the original file settings.

Method: get_proportional_height(width, height, new_width) [static]

 get_proportional_height(width, height, new_width) 

Gets a proportional height.

Parameters:

ParameterTypeDescription
widthintThe width.
heightintThe height.
new_widthintThe new width.

Returns

TypeDescription
intThe proportional height.

Method: get_proportional_width(width, height, new_height) [static]

 get_proportional_width(width, height, new_height) 

Gets a proportional width.

Parameters:

ParameterTypeDescription
widthintThe width.
heightintThe height.
new_heightintThe new height.

Returns

TypeDescription
intThe proportional width.

Method: get_serialized_stream(image_options, clipping_rectangle, page_number)

 get_serialized_stream(image_options, clipping_rectangle, page_number) 

Converts to aps.

Parameters:

ParameterTypeDescription
image_optionsImageOptionsBaseThe image options.
clipping_rectangleRectangleThe clipping rectangle.
page_numberint[]The page number.

Returns

TypeDescription
_io.BufferedRandomThe serialized stream

Method: load(file_path) [static]

 load(file_path) 

Loads a new image from the specified file.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load(file_path, load_options) [static]

 load(file_path, load_options) 

Loads a new image from the specified file.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to load image from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
ImageThe loaded image.

Method: load(stream) [static]

 load(stream) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load(stream, load_options) [static]

 load(stream, load_options) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
ImageThe loaded image.

Method: load_stream(stream) [static]

 load_stream(stream) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load_stream_with_options(stream, load_options) [static]

 load_stream_with_options(stream, load_options) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
ImageThe loaded image.

Method: load_with_options(file_path, load_options) [static]

 load_with_options(file_path, load_options) 

Loads a new image from the specified file.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to load image from.
load_optionsLoadOptionsThe load options.

Returns

TypeDescription
ImageThe loaded image.

Method: remove_background(settings)

 remove_background(settings) 

Removes the background.

Parameters:

ParameterTypeDescription
settingsRemoveBackgroundSettingsThe settings.

Method: resize(new_width, new_height)

 resize(new_width, new_height) 

Resizes the image. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.

Method: resize(new_width, new_height, resize_type)

 resize(new_width, new_height, resize_type) 

Resizes the image.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.
resize_typeResizeTypeThe resize type.

Method: resize(new_width, new_height, settings)

 resize(new_width, new_height, settings) 

Resizes the image.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.
settingsImageResizeSettingsThe resize settings.

Method: resize_by_settings(new_width, new_height, settings)

 resize_by_settings(new_width, new_height, settings) 

Resizes the image.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.
settingsImageResizeSettingsThe resize settings.

Method: resize_by_type(new_width, new_height, resize_type)

 resize_by_type(new_width, new_height, resize_type) 

Resizes the image.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.
resize_typeResizeTypeThe resize type.

Method: resize_height_proportionally(new_height)

 resize_height_proportionally(new_height) 

Resizes the height proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.

Parameters:

ParameterTypeDescription
new_heightintThe new height.

Method: resize_height_proportionally(new_height, resize_type)

 resize_height_proportionally(new_height, resize_type) 

Resizes the height proportionally.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
resize_typeResizeTypeType of the resize.

Method: resize_height_proportionally(new_height, settings)

 resize_height_proportionally(new_height, settings) 

Resizes the height proportionally.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
settingsImageResizeSettingsThe image resize settings.

Method: resize_height_proportionally_settings(new_height, settings)

 resize_height_proportionally_settings(new_height, settings) 

Resizes the height proportionally.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
settingsImageResizeSettingsThe image resize settings.

Method: resize_width_proportionally(new_width)

 resize_width_proportionally(new_width) 

Resizes the width proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.

Parameters:

ParameterTypeDescription
new_widthintThe new width.

Method: resize_width_proportionally(new_width, resize_type)

 resize_width_proportionally(new_width, resize_type) 

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
resize_typeResizeTypeType of the resize.

Method: resize_width_proportionally(new_width, settings)

 resize_width_proportionally(new_width, settings) 

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
settingsImageResizeSettingsThe image resize settings.

Method: resize_width_proportionally_settings(new_width, settings)

 resize_width_proportionally_settings(new_width, settings) 

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
settingsImageResizeSettingsThe image resize settings.

Method: rotate_flip(rotate_flip_type)

 rotate_flip(rotate_flip_type) 

Rotates, flips, or rotates and flips the image.

Parameters:

ParameterTypeDescription
rotate_flip_typeRotateFlipTypeType of the rotate flip.

Method: save(file_path)

 save(file_path) 

Saves the image to the specified file location.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to save the image to.

Method: save(file_path, options)

 save(file_path, options) 

Saves the object’s data to the specified file location in the specified file format according to save options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.

Method: save(file_path, options, bounds_rectangle)

 save(file_path, options, bounds_rectangle) 

Saves the object’s data to the specified file location in the specified file format according to save options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.
bounds_rectangleRectangleThe destination image bounds rectangle. Set the empty rectangle for use sourse bounds.

Method: save(file_path, over_write)

 save(file_path, over_write) 

Saves the object’s data to the specified file location.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to save the object’s data to.
over_writeboolif set to true over write the file contents, otherwise append will occur.

Method: save(stream)

 save(stream) 

Saves the data.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save data to.

Method: save(stream, options_base)

 save(stream, options_base) 

Saves the image’s data to the specified stream in the specified file format according to save options.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save the image’s data to.
options_baseImageOptionsBaseThe save options.

Method: save(stream, options_base, bounds_rectangle)

 save(stream, options_base, bounds_rectangle) 

Saves the image’s data to the specified stream in the specified file format according to save options.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save the image’s data to.
options_baseImageOptionsBaseThe save options.
bounds_rectangleRectangleThe destination image bounds rectangle. Set the empty rectangle for use source bounds.

Method: save_to_stream(stream)

 save_to_stream(stream) 

Saves the object’s data to the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save the object’s data to.

Method: save_to_stream_with_options(stream, options_base)

 save_to_stream_with_options(stream, options_base) 

Saves the image’s data to the specified stream in the specified file format according to save options.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save the image’s data to.
options_baseImageOptionsBaseThe save options.

Method: save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)

 save_to_stream_with_options_rect(stream, options_base, bounds_rectangle) 

Saves the image’s data to the specified stream in the specified file format according to save options.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to save the image’s data to.
options_baseImageOptionsBaseThe save options.
bounds_rectangleRectangleThe destination image bounds rectangle. Set the empty rectangle for use source bounds.

Method: save_with_options(file_path, options)

 save_with_options(file_path, options) 

Saves the object’s data to the specified file location in the specified file format according to save options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.

Method: save_with_options_rect(file_path, options, bounds_rectangle)

 save_with_options_rect(file_path, options, bounds_rectangle) 

Saves the object’s data to the specified file location in the specified file format according to save options.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.
bounds_rectangleRectangleThe destination image bounds rectangle. Set the empty rectangle for use sourse bounds.

Method: set_palette(palette, update_colors)

 set_palette(palette, update_colors) 

Sets the image palette.

Parameters:

ParameterTypeDescription
paletteIColorPaletteThe palette to set.
update_colorsboolif set to true colors will be updated according to the new palette; otherwise color indexes remain unchanged. Note that unchanged indexes may crash the image on loading if some indexes have no corresponding palette entries.