EmfImage 类
Summary: The API for Enhanced Metafile Format (EMF) vector image format support is
a comprehensive tool for processing graphical images in a device-independent
manner while preserving their original properties. Developed to maintain
proportions, dimensions, colors, and other graphic attributes, it includes
EMF Plus format support and features for cropping regions, resizing canvas
and images, rotating, flipping, setting image palettes, exporting and importing
to APS device context, compressing and converting EMF to other formats, ensuring
versatile manipulation and seamless integration of EMF images across applications.
Module: aspose.imaging.fileformats.emf
Full Name: aspose.imaging.fileformats.emf.EmfImage
Inheritance: IObjectWithBounds, IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, IObjectWithSizeF, MetaImage
Constructors
| Name | 描述 |
|---|---|
| EmfImage() | 通过初始化一个新的实例来开始使用 EMF 图像 EmfImage 类。非常适合快速、轻松且高效地将 EMF 图像整合到 您的项目中。 |
| EmfImage(width, height) | 通过指定宽度 和高度参数,创建 EmfImage 类的新实例。此构造函数简化了使用特定尺寸初始化 EMF 图像的过程,提升了开发工作流的效率。 |
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 | 获取或设置指示图像是否具有背景颜色的值。 |
| header | EmfMetafileHeader | r/w | 使用此属性检索或修改 EMF 元文件头记录。 非常适合在应用程序中高效管理元文件数据。通过流畅访问元文件头信息,提升工作流。 |
| height | int | r | 获取对象的高度。 |
| height_f | float | r | 检索图像的高度,以便实现精确的渲染和布局调整。 访问高度属性可确保在不同平台和应用程序之间的兼容性和无缝集成。 |
| interrupt_monitor | InterruptMonitor | r/w | 获取或设置中断监视器。 |
| is_cached | bool | r | 访问一个值,以指示对象的数据是否已缓存, 从而消除额外读取数据的需求。通过快速确定是否有可立即访问的缓存数据来提升效率。使用流畅的数据检索过程,优化您的工作流。 |
| metadata | ImageMetadata | r | 获取图像元数据。 |
| palette | IColorPalette | r/w | 获取或设置颜色调色板。当像素直接表示时,不使用颜色调色板。 |
| records | MetaObjectList | 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
Constructor: EmfImage()
EmfImage()
通过初始化一个新的实例来开始使用 EMF 图像
EmfImage 类。非常适合快速、轻松且高效地将 EMF 图像整合到
您的项目中。
Constructor: EmfImage(width, height)
EmfImage(width, height)
通过指定宽度
和高度参数,创建 EmfImage 类的新实例。此构造函数简化了使用特定尺寸初始化 EMF 图像的过程,提升了开发工作流的效率。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| width | int | 宽度。 |
| height | int | 高度。 |
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[] | 图像数组 |
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_missed_fonts()
get_missed_fonts()
返回在元文件中使用但未找到的字体列表。
Returns
| Type | Description |
|---|---|
| string[] | 字体列表 |
Method: get_original_options()
get_original_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: get_used_fonts()
get_used_fonts()
使用此方法检索元文件中使用的字体列表。获取
字体使用情况的洞察,促进对字体资源的高效管理和优化,以提升渲染和显示的保真度。
Returns
| Type | Description |
|---|---|
| string[] | 字体列表 |
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_canvas(new_rectangle)
resize_canvas(new_rectangle)
使用此函数轻松调整画布大小。非常适合在不更改内容的情况下调整图像的整体
尺寸。提升展示效果,并轻松为各种显示尺寸准备图像。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| new_rectangle | Rectangle | 新的矩形。 |
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)
将数据保存到指定的 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 | 如果 metadata 不为 null 且 IMetadataContainer 实例 支持和/或实现 IImageMetadataFormat 实例,则为 true;否则为 false。 |
Examples
The following example shows how to convert compressed images (.emz,.wmz, *.svgz) to a raster format
from aspose.imaging import Image, Color
from aspose.imaging.imageoptions import PngOptions, VectorRasterizationOptions
from os.path import join
from aspose.pycore import as_of
files = ["example.emz", "example.wmz", "example.svgz"]
base_folder: str = join("D:", "Compressed")
for file in files:
input_file: str = join(base_folder, file)
out_file: str = input_file + ".png"
with Image.load(input_file) as image:
vector_rasterization_options = aspycore.as_of(image.get_default_options([Color.white, image.width, image.height]), VectorRasterizationOptions)
obj_init = PngOptions()
obj_init.vector_rasterization_options = vector_rasterization_options
image.save(out_file, obj_init)
The following example shows how to convert a emz images to emf format
import aspose.pycore as aspycore
from aspose.imaging import Image, SizeF
from aspose.imaging.imageoptions import EmfRasterizationOptions, EmfOptions
from os.path import join
file: str = "example.emz"
base_folder: str = join("D:", "Compressed")
input_file: str = join(base_folder, file)
out_file: str = input_file + ".emf"
with Image.load(input_file) as image:
obj_init = EmfRasterizationOptions()
obj_init.page_size = aspycore.cast(SizeF, image.size)
obj_init2 = EmfOptions()
obj_init2.vector_rasterization_options = obj_init
image.save(out_file, obj_init2)
The following example shows how to convert a emf images to emz format
from os.path import join as path_combine
import aspose.pycore as aspycore
from aspose.imaging import Image, SizeF
from aspose.imaging.imageoptions import EmfRasterizationOptions, EmfOptions
file = "input.emf"
base_folder = path_combine("D:", "Compressed")
input_file = path_combine(base_folder, file)
out_file = input_file + ".emz"
with Image.load(input_file) as image:
vector_rasterization_options = EmfRasterizationOptions()
vector_rasterization_options.page_size = aspycore.cast(SizeF, image.size)
obj_init2 = EmfOptions()
obj_init2.vector_rasterization_options = vector_rasterization_options
obj_init2.compress = True
image.save(out_file, obj_init2)