VectorImage 类
Summary: The vector image is the base class for all type of vector images.
Module: aspose.imaging
Full Name: aspose.imaging.VectorImage
Inheritance: IObjectWithBounds, IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, IObjectWithSizeF, Image
Properties
| Name | Type | Access | 描述 |
|---|---|---|---|
| auto_adjust_palette | bool | r/w | 获取或设置一个值,指示是否自动调整调色板。 |
| background_color | Color | r/w | 获取或设置背景颜色的值。 |
| bits_per_pixel | int | r | 获取图像每像素位数计数。 |
| bounds | Rectangle | r | 获取图像的边界。 |
| buffer_size_hint | int | r/w | 获取或设置缓冲区大小提示,该提示定义了所有内部缓冲区的最大允许大小。 |
| container | Image | r | 获取 Image 容器。 |
| data_stream_container | StreamContainer | r | 获取对象的数据流。 |
| disposed | bool | r | 获取一个值,指示此实例是否已释放。 |
| exif_data | ExifData | r/w | 获取或设置 Exif 数据。 |
| file_format | FileFormat | r | 获取文件格式的值 |
| has_background_color | bool | r/w | 获取或设置指示图像是否具有背景颜色的值。 |
| height | int | r | 获取图像高度。 |
| height_f | float | r | 获取对象的高度(单位为英寸)。 |
| interrupt_monitor | InterruptMonitor | r/w | 获取或设置中断监视器。 |
| is_cached | bool | r | 获取一个值,指示对象的数据当前是否已缓存且无需读取数据。 |
| metadata | ImageMetadata | r | 获取图像元数据。 |
| palette | IColorPalette | r/w | 获取或设置颜色调色板。当像素直接表示时,不使用颜色调色板。 |
| size | Size | r | 获取图像尺寸。 |
| size_f | SizeF | r | 获取对象的尺寸(单位为英寸)。 |
| use_palette | bool | r | 获取一个值,指示是否使用图像调色板。 |
| width | int | r | 获取图像宽度。 |
| width_f | float | r | 获取对象的宽度(单位为英寸)。 |
| xmp_data | XmpPacketWrapper | r/w | 获取或设置 Xmp 数据。 |
Methods
Method: can_load(file_path) [static]
can_load(file_path)
确定是否可以从指定的文件路径加载图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load(file_path, load_options) [static]
can_load(file_path, load_options)
确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load(stream) [static]
can_load(stream)
确定是否可以从指定的流加载图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 要加载的流。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load(stream, load_options) [static]
can_load(stream, load_options)
确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 要加载的流。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load_stream(stream) [static]
can_load_stream(stream)
确定是否可以从指定的流加载图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 要加载的流。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load_stream_with_options(stream, load_options) [static]
can_load_stream_with_options(stream, load_options)
确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 要加载的流。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_load_with_options(file_path, load_options) [static]
can_load_with_options(file_path, load_options)
确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: can_save(options)
can_save(options)
确定是否可以将图像保存为由传入的保存选项表示的指定文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| options | ImageOptionsBase | 要使用的保存选项。 |
Returns
| Type | Description |
|---|---|
| bool |
Method: create(files) [static]
create(files)
创建包含指定文件的多页图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 文件 | string[] | 文件。 |
Returns
| Type | Description |
|---|---|
| Image | 多页图像 |
Method: create(files, throw_exception_on_load_error) [static]
create(files, throw_exception_on_load_error)
创建包含指定文件的多页图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 文件 | string[] | 文件。 |
| throw_exception_on_load_error | bool | 如果设置为 |
Returns
| Type | Description |
|---|---|
| Image | 多页图像 |
Method: create(image_options, width, height) [static]
create(image_options, width, height)
使用指定的创建选项创建新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| image_options | ImageOptionsBase | 图像选项。 |
| width | int | 宽度。 |
| height | int | 高度。 |
Returns
| Type | Description |
|---|---|
| Image | 新创建的图像。 |
Method: create(image_options, width, height, pixels) [static]
create(image_options, width, height, pixels)
创建一个来自提供的像素数组的 RasterImage 实例。
验证指定的宽度和高度是否与像素数据的维度匹配。
仅当库处于授权模式时才能使用此方法。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| image_options | ImageOptionsBase | 用于创建 RasterImage 的选项。 |
| width | int | RasterImage 的宽度。 |
| height | int | RasterImage 的高度。 |
| 像素 | int[] | 用于填充图像的像素值数组。 |
Returns
| Type | Description |
|---|---|
| Image | 使用提供的像素数据填充的 RasterImage。 |
Method: create(images) [static]
create(images)
使用指定的图像作为页面创建新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| images | Image[] | 图像。 |
Returns
| Type | Description |
|---|---|
| Image | Image 作为 IMultipageImage |
Method: create(images, dispose_images) [static]
create(images, dispose_images)
创建一个新图像,将指定的图像作为页面。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| images | Image[] | 图像。 |
| dispose_images | bool | 如果设置为 |
Returns
| Type | Description |
|---|---|
| Image | Image 作为 IMultipageImage |
Method: create(multipage_create_options) [static]
create(multipage_create_options)
创建指定的多页创建选项。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| multipage_create_options | MultipageCreateOptions | 多页创建选项。 |
Returns
| Type | Description |
|---|---|
| Image | 多页图像 |
Method: create_from_files(files) [static]
create_from_files(files)
创建包含指定文件的多页图像,将其作为延迟加载页面。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 文件 | string[] | 文件。 |
Returns
| Type | Description |
|---|---|
| Image | 多页图像 |
Method: create_from_files(files, throw_exception_on_load_error) [static]
create_from_files(files, throw_exception_on_load_error)
创建包含指定文件的多页图像,将其作为延迟加载页面。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 文件 | string[] | 文件。 |
| throw_exception_on_load_error | bool | 如果设置为 |
Returns
| Type | Description |
|---|---|
| Image | 多页图像 |
Method: create_from_images(images) [static]
create_from_images(images)
使用指定的图像作为页面创建新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| images | Image[] | 图像。 |
Returns
| Type | Description |
|---|---|
| Image | Image 作为 IMultipageImage |
Method: create_from_images(images, dispose_images) [static]
create_from_images(images, dispose_images)
创建一个新图像,将指定的图像作为页面。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| images | Image[] | 图像。 |
| dispose_images | bool | 如果设置为 |
Returns
| Type | Description |
|---|---|
| Image | Image 作为 IMultipageImage |
Method: crop(left_shift, right_shift, top_shift, bottom_shift)
crop(left_shift, right_shift, top_shift, bottom_shift)
使用位移裁剪图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| left_shift | int | 左移。 |
| right_shift | int | 右移。 |
| top_shift | int | 上移。 |
| bottom_shift | int | 下移。 |
Method: crop(rectangle)
crop(rectangle)
裁剪指定的矩形。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rectangle | Rectangle | 矩形。 |
Method: get_default_options(args)
get_default_options(args)
获取默认图像选项。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| args | System.Object | 参数。 |
Returns
| Type | Description |
|---|---|
| ImageOptionsBase | 默认图像选项。 |
Method: get_embedded_images()
get_embedded_images()
获取嵌入的图像。
Returns
| Type | Description |
|---|---|
| EmbeddedImage[] | 图像数组 |
See also:
Example # 1: Support extracting embedded raster images from a vector image
Method: get_file_format(file_path) [static]
get_file_format(file_path)
获取文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
Returns
| Type | Description |
|---|---|
| FileFormat | 确定的文件格式。 |
Method: get_file_format(stream) [static]
get_file_format(stream)
获取文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 该流。 |
Returns
| Type | Description |
|---|---|
| FileFormat | 确定的文件格式。 |
Method: get_file_format_of_stream(stream) [static]
get_file_format_of_stream(stream)
获取文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 该流。 |
Returns
| Type | Description |
|---|---|
| FileFormat | 确定的文件格式。 |
Method: get_fitting_rectangle(rectangle, pixels, width, height) [static]
get_fitting_rectangle(rectangle, pixels, width, height)
获取适合当前图像的矩形。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rectangle | Rectangle | 用于获取合适矩形的矩形。 |
| 像素 | int[] | 32 位 ARGB 像素。 |
| width | int | 对象宽度。 |
| height | int | 对象高度。 |
Returns
| Type | Description |
|---|---|
| Rectangle | 适配矩形,若未找到适配矩形则抛出异常。 |
Method: get_fitting_rectangle(rectangle, width, height) [static]
get_fitting_rectangle(rectangle, width, height)
获取适合当前图像的矩形。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rectangle | Rectangle | 用于获取合适矩形的矩形。 |
| width | int | 对象宽度。 |
| height | int | 对象高度。 |
Returns
| Type | Description |
|---|---|
| Rectangle | 适配矩形,若未找到适配矩形则抛出异常。 |
Method: get_original_options()
get_original_options()
根据原始文件设置获取选项。
这有助于保持原始图像的位深度和其他参数不变。
例如,如果我们加载一个每像素 1 位的黑白 PNG 图像,然后使用
DataStreamSupporter.save(file_path) 方法保存,它将生成每像素 8 位的输出 PNG 图像。
为避免这种情况并以每像素 1 位保存 PNG 图像,请使用此方法获取相应的保存选项,并将其
作为第二个参数传递给 Image.save(file_path, options) 方法。
Returns
| Type | Description |
|---|---|
| ImageOptionsBase | 基于原始文件设置的选项。 |
Method: get_proportional_height(width, height, new_width) [static]
get_proportional_height(width, height, new_width)
获取比例高度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| width | int | 宽度。 |
| height | int | 高度。 |
| new_width | int | 新的宽度。 |
Returns
| Type | Description |
|---|---|
| int | 比例高度。 |
Method: get_proportional_width(width, height, new_height) [static]
get_proportional_width(width, height, new_height)
获取比例宽度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| width | int | 宽度。 |
| height | int | 高度。 |
| new_height | int | 新的高度。 |
Returns
| Type | Description |
|---|---|
| int | 比例宽度。 |
Method: get_serialized_stream(image_options, clipping_rectangle, page_number)
get_serialized_stream(image_options, clipping_rectangle, page_number)
转换为 aps。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| image_options | ImageOptionsBase | 图像选项。 |
| clipping_rectangle | Rectangle | 裁剪矩形。 |
| page_number | int[] | 页码。 |
Returns
| Type | Description |
|---|---|
| _io.BufferedRandom | 序列化流 |
Method: load(file_path) [static]
load(file_path)
从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 加载图像的文件路径或 URL。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load(file_path, load_options) [static]
load(file_path, load_options)
从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 加载图像的文件路径或 URL。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load(stream) [static]
load(stream)
从指定的流加载新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 加载图像的流。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load(stream, load_options) [static]
load(stream, load_options)
从指定的流加载新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 加载图像的流。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load_stream(stream) [static]
load_stream(stream)
从指定的流加载新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 加载图像的流。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load_stream_with_options(stream, load_options) [static]
load_stream_with_options(stream, load_options)
从指定的流加载新图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 加载图像的流。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: load_with_options(file_path, load_options) [static]
load_with_options(file_path, load_options)
从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 加载图像的文件路径或 URL。 |
| load_options | LoadOptions | 加载选项。 |
Returns
| Type | Description |
|---|---|
| Image | 已加载的图像。 |
Method: remove_background(settings)
remove_background(settings)
移除背景。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| settings | RemoveBackgroundSettings | 设置。 |
Method: resize(new_width, new_height)
resize(new_width, new_height)
调整图像大小。使用默认的 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| new_height | int | 新的高度。 |
Method: resize(new_width, new_height, resize_type)
resize(new_width, new_height, resize_type)
调整指定的新宽度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| new_height | int | 新的高度。 |
| resize_type | ResizeType | 调整大小的类型。 |
Method: resize(new_width, new_height, settings)
resize(new_width, new_height, settings)
使用扩展选项调整图像大小。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| new_height | int | 新的高度。 |
| settings | ImageResizeSettings | 调整大小设置。 |
Method: resize_by_settings(new_width, new_height, settings)
resize_by_settings(new_width, new_height, settings)
调整图像大小。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| new_height | int | 新的高度。 |
| settings | ImageResizeSettings | 调整大小设置。 |
Method: resize_by_type(new_width, new_height, resize_type)
resize_by_type(new_width, new_height, resize_type)
调整图像大小。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| new_height | int | 新的高度。 |
| resize_type | ResizeType | 调整大小类型。 |
Method: resize_height_proportionally(new_height)
resize_height_proportionally(new_height)
按比例调整高度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_height | int | 新的高度。 |
Method: resize_height_proportionally(new_height, resize_type)
resize_height_proportionally(new_height, resize_type)
按比例调整高度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_height | int | 新的高度。 |
| resize_type | ResizeType | 调整大小的类型。 |
Method: resize_height_proportionally(new_height, settings)
resize_height_proportionally(new_height, settings)
按比例调整高度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_height | int | 新的高度。 |
| settings | ImageResizeSettings | 图像调整大小设置。 |
Method: resize_height_proportionally_settings(new_height, settings)
resize_height_proportionally_settings(new_height, settings)
按比例调整高度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_height | int | 新的高度。 |
| settings | ImageResizeSettings | 图像调整大小设置。 |
Method: resize_width_proportionally(new_width)
resize_width_proportionally(new_width)
按比例调整宽度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
Method: resize_width_proportionally(new_width, resize_type)
resize_width_proportionally(new_width, resize_type)
按比例调整宽度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| resize_type | ResizeType | 调整大小的类型。 |
Method: resize_width_proportionally(new_width, settings)
resize_width_proportionally(new_width, settings)
按比例调整宽度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| settings | ImageResizeSettings | 图像调整大小设置。 |
Method: resize_width_proportionally_settings(new_width, settings)
resize_width_proportionally_settings(new_width, settings)
按比例调整宽度。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_width | int | 新的宽度。 |
| settings | ImageResizeSettings | 图像调整大小设置。 |
Method: rotate(angle)
rotate(angle)
围绕中心旋转图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 角度 | float | 旋转角度(以度为单位)。正值将顺时针旋转。 |
Method: rotate_flip(rotate_flip_type)
rotate_flip(rotate_flip_type)
旋转、翻转或同时旋转和翻转图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rotate_flip_type | RotateFlipType | 旋转翻转的类型。 |
Method: save(file_path)
save(file_path)
将图像保存到指定的文件位置。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 保存图像的文件路径。 |
Method: save(file_path, options)
save(file_path, options)
根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| options | ImageOptionsBase | 选项。 |
Method: save(file_path, options, bounds_rectangle)
save(file_path, options, bounds_rectangle)
根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| options | ImageOptionsBase | 选项。 |
| bounds_rectangle | Rectangle | 目标图像边界矩形。将空矩形设置为使用源边界。 |
Method: save(file_path, over_write)
save(file_path, over_write)
将对象的数据保存到指定的文件位置。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 保存对象数据的文件路径。 |
| over_write | bool | 如果设置为 |
Method: save(stream)
save(stream)
将对象的数据保存到指定的流中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 用于保存对象数据的流。 |
Method: save(stream, options_base)
save(stream, options_base)
根据保存选项,将图像的数据保存到指定流中的指定文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 保存图像数据的流。 |
| options_base | ImageOptionsBase | 保存选项。 |
Method: save(stream, options_base, bounds_rectangle)
save(stream, options_base, bounds_rectangle)
根据保存选项,将图像的数据保存到指定流中的指定文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 保存图像数据的流。 |
| options_base | ImageOptionsBase | 保存选项。 |
| bounds_rectangle | Rectangle | 目标图像边界矩形。将空矩形设置为使用源边界。 |
Method: save_to_stream(stream)
save_to_stream(stream)
将对象的数据保存到指定的流中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 用于保存对象数据的流。 |
Method: save_to_stream_with_options(stream, options_base)
save_to_stream_with_options(stream, options_base)
根据保存选项,将图像的数据保存到指定流中的指定文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 保存图像数据的流。 |
| options_base | ImageOptionsBase | 保存选项。 |
Method: save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)
save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)
根据保存选项,将图像的数据保存到指定流中的指定文件格式。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 流 | _io.BufferedRandom | 保存图像数据的流。 |
| options_base | ImageOptionsBase | 保存选项。 |
| bounds_rectangle | Rectangle | 目标图像边界矩形。将空矩形设置为使用源边界。 |
Method: save_with_options(file_path, options)
save_with_options(file_path, options)
根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| options | ImageOptionsBase | 选项。 |
Method: save_with_options_rect(file_path, options, bounds_rectangle)
save_with_options_rect(file_path, options, bounds_rectangle)
根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| file_path | string | 文件路径。 |
| options | ImageOptionsBase | 选项。 |
| bounds_rectangle | Rectangle | 目标图像边界矩形。将空矩形设置为使用源边界。 |
Method: set_palette(palette, update_colors)
set_palette(palette, update_colors)
设置图像调色板。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| palette | IColorPalette | 要设置的调色板。 |
| update_colors | bool | 如果设置为 |
Method: try_set_metadata(metadata)
try_set_metadata(metadata)
尝试设置 metadata 实例,如果此 Image 实例支持并实现 IImageMetadataFormat 类型。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| metadata | IImageMetadataFormat | 元数据。 |
Returns
| Type | Description |
|---|---|
| bool | 如果 Image 实例支持并实现 IImageMetadataFormat 类型,则为 true;否则为 false。 |
Examples
Support extracting embedded raster images from a vector image
from aspose.pycore import as_of
from aspose.imaging import Image, VectorImage
from aspose.imaging.imageoptions import PngOptions
inputFileName = "test.cdr"
with Image.load(inputFileName) as image:
vectorImage = as_of(image, VectorImage)
images = vectorImage.get_embedded_images()
for i, im in enumerate(images):
outFileName = f"image{i}.png"
with im as _:
im.image.save(outFileName, PngOptions())