TiffImage 类

Summary: Process Tagged Image File Format (TIFF) raster images with our API, offering
comprehensive support for various resolutions and advanced editing capabilities
like EXIF data manipulation and alpha channels. Normalize angles for scanned images,
resize, transform to grayscale, and apply filters, gamma corrections and image
parameters adjustments with ease. Seamlessly handle multi-frame TIFF files,
create graphics paths, add shapes, and effortlessly save images to different formats.

Module: aspose.imaging.fileformats.tiff

Full Name: aspose.imaging.fileformats.tiff.TiffImage

Inheritance: IObjectWithBounds, IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IMultipageImage, IMultipageImageExt, RasterCachedMultipageImage

Constructors

Name描述
TiffImage(frame)初始化 TiffImage 类的新对象,指定
帧参数。此构造函数有助于创建 TiffImage
实例,允许开发者指定要加载或处理的帧,
简化其应用程序中的 Tiff 图像处理任务。
TiffImage(frames)创建 TiffImage 类的新实例,提供一个
帧列表作为参数。此构造函数使得能够使用多个帧初始化 TiffImage
对象,促进在软件应用中高效处理和处理
TIFF 图像序列。

Properties

NameTypeAccess描述
active_frameTiffFramer/w无缝管理活动帧,促进在指定上下文中的动态导航和
操作。让您的应用程序能够高效地与多媒体内容交互,提升用户参与度和生产力。
auto_adjust_paletteboolr/w获取或设置一个值,指示是否自动调整调色板。
background_colorColorr/w获取或设置背景颜色的值。
bits_per_pixelintr获取图像每像素位数计数。
boundsRectangler获取对象的边界。
buffer_size_hintintr/w获取或设置缓冲区大小提示,该提示定义了所有内部缓冲区的最大允许大小。
byte_orderTiffByteOrderr/w无缝切换 TIFF 文件的字节序,确保对
数据解释的精确控制。为您的应用程序提供灵活性,以适应
多种文件规范,提升兼容性和数据处理的效率。
containerImager获取 Image 容器。
data_stream_containerStreamContainerr获取对象的数据流。
disposedboolr获取一个值,指示此实例是否已释放。
exif_dataExifDatar/w获取或设置 Exif 实例。
file_formatFileFormatr检索与图像关联的文件格式值。此属性作为
图像元数据检索的关键方面,允许软件应用程序
高效地识别和解释图像数据的格式。
framesTiffFrame[]r检索 TiffFrame 实例的数组,以实现对 TIFF 图像中各个帧的全面
访问和操作。利用该数组的强大功能来简化图像处理工作流,确保对视觉内容的精确
控制和优化。
has_alphaboolr确定图像是否具有 alpha 通道,为渲染和合成操作提供关键信息
。将此功能集成到视觉处理工作流中,以优化
流程,确保对透明元素的准确
表现和操作。
has_background_colorboolr/w获取或设置指示图像是否具有背景颜色的值。
has_transparent_colorboolr/w获取指示图像是否具有透明颜色的值。
heightintr获取图像高度。
horizontal_resolutionfloatr/w检索指定 Image 的水平分辨率(每英寸像素)
,以便实现精确的调整和渲染能力。
轻松访问必需的图像元数据,提升图像处理工作流的效率,
为增强用户体验提供支持。
image_opacityfloatr获取此图像的不透明度。
interrupt_monitorInterruptMonitorr/w获取或设置中断监视器。
is_cachedboolr获取指示图像数据当前是否已缓存的值。
is_raw_data_availableboolr获取指示是否支持原始数据加载的值。
metadataImageMetadatar获取或设置来自帧的 XMP 数据。
page_countintr检索指定文档的总页数,以便
高效导航和管理多页内容。整合此
功能以提升用户体验,实现对
完整文档结构的无缝访问。
pagesImage[]r无缝访问文档的页面,支持在内容结构内的动态导航和
操作。为您的应用程序提供高效的单页访问,
简化文档处理流程,
并提升用户交互体验。
paletteIColorPaletter/w获取或设置颜色调色板。当像素直接表示时,不使用颜色调色板。
premultiply_componentsboolr/w指示组件是否需要预乘,以确保对视觉元素的高效处理
。通过切换此属性来提升渲染过程,
简化图形工作流,实现性能优化。
raw_custom_color_converterIColorConverterr/w获取或设置自定义颜色转换器
raw_data_formatPixelDataFormatr获取原始数据格式。
raw_data_settingsRawDataSettingsr获取当前原始数据设置。注意,使用这些设置时,数据将在不进行转换的情况下加载。
raw_fallback_indexintr/w获取或设置当调色板索引超出范围时使用的回退索引
raw_indexed_color_converterIIndexedColorConverterr/w获取或设置索引颜色转换器
raw_line_sizeintr获取以字节为单位的原始行大小。
sizeSizer获取对象大小。
transparent_colorColorr/w获取图像的透明颜色。
update_xmp_databoolr/w获取或设置一个值,指示是否更新 XMP 元数据。
use_paletteboolr获取一个值,指示是否使用图像调色板。
use_raw_databoolr/w获取或设置一个值,指示在可用原始数据加载时是否使用原始数据加载。
vertical_resolutionfloatr/w获取指定 Image 的垂直分辨率(每英寸像素)
,实现精确的调整和渲染优化。
轻松利用关键的图像数据,简化图像处理工作流,
确保应用程序的卓越质量和性能。
widthintr获取图像宽度。
xmp_dataXmpPacketWrapperr/w获取或设置 Xmp 数据。

Methods

Name描述
add(image)将指定图像的帧无缝添加到当前帧中,
整合其内容并提升组合灵活性。将此方法集成到您的应用程序中,
简化帧管理和操作,
促进对多帧图像的高效处理。
add_frame(frame)将指定帧无缝合并到图像中,扩展其内容和多样性。
利用此方法提升图像组合和管理,
使您的应用程序能够高效处理多帧图像。
add_frames(frames)将帧数组无缝集成到图像中,丰富其内容和多样性。
利用此方法提升图像组合和管理,
使您的应用程序能够高效处理多帧图像。
add_page(page)将新页面无缝合并到现有图像中,扩展其内容
和多功能性。使用此方法可提升文档构成和
管理,使您的应用程序能够高效处理多页图像。
adjust_brightness(brightness)实现对图像的 brightness 调整,允许
修改整体亮度水平。将此方法整合到您的图像处理工作流中,
以提升可见性并改善
应用程序中图像的视觉质量。
adjust_contrast(contrast)提升 Image 实例的对比度,
放大其亮暗区域的差异。
将此功能集成,以改善图像的视觉清晰度和整体质量,
为您的应用程序提供更佳的图像表现。
adjust_gamma(gamma)对图像应用伽马校正,调整像素强度以实现
所需的色彩平衡。将此方法纳入您的图像处理
工作流,以提升视觉质量并提高后续
分析或显示任务的准确性。
adjust_gamma(gamma_red, gamma_green, gamma_blue)使用红、
绿和蓝通道的单独系数对图像进行伽马校正,以实现对色彩平衡
和对比度的精细调节。将此方法集成到您的图像处理管道中,
实现对颜色渲染的精确控制,并在您的应用程序中提升视觉保真度。
align_resolutions()实现 AlignResolutions 辅助方法,以同步水平和
垂直分辨率,确保图像尺寸的一致性。此功能
通过统一分辨率参数,优化视觉质量和跨各种平台与
设备的一致性,从而简化图像处理工作流。
analyze_percentage_digital_signature(password)计算提取数据与原始密码之间的相似度百分比。
auto_brightness_contrast()对整个图像执行自动自适应亮度和对比度归一化。
auto_rotate()自动根据从 Exif
元数据中提取的方向数据旋转图像。此方法确保图像以正确的方向显示,
提升用户体验并消除手动调整的需求。通过
分析 Exif 信息,图像相应旋转,提供跨不同平台和设备的无缝
浏览体验。此自动旋转过程简化了图像处理,并在处理大量方向各异的图像批次时,
提高整体可用性。
binarize_bradley(brightness_difference)使用 Bradley 的自适应阈值算法和积分图阈值进行图像二值化
binarize_bradley(brightness_difference, window_size)在图像上实现二值化,采用 Bradley 自适应阈值
算法结合积分图阈值。此方法根据图像邻域动态计算
局部阈值,提升对不同光照条件的适应性,并确保后续
处理任务的稳健分割。
binarize_fixed(threshold)使用预定义阈值对图像进行二值化,将其转换为
前景和背景区域明确的二值图像。将此方法纳入您的图像处理工作流,以便于分割和特征
提取任务,提升图像分析的准确性和效率。
binarize_otsu()利用 Otsu 阈值法对图像进行二值化,自动
根据图像直方图确定最佳阈值。将此方法集成到您的图像处理工作流,以实现有效的分割
和特征提取,提升图像分析任务的准确性和可靠性。
blend(origin, overlay, overlay_alpha)将此图像实例与 overlay 图像混合。
blend(origin, overlay, overlay_area, overlay_alpha)将此图像实例与 overlay 图像混合。
cache_data()缓存私有数据。
can_load(file_path)确定是否可以从指定的文件路径加载图像。
can_load(file_path, load_options)确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。
can_load(stream)确定是否可以从指定的流加载图像。
can_load(stream, load_options)确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions
can_load_stream(stream)确定是否可以从指定的流加载图像。
can_load_stream_with_options(stream, load_options)确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions
can_load_with_options(file_path, load_options)确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。
can_save(options)确定是否可以将图像保存为由传入的保存选项表示的指定文件格式。
create(files)创建包含指定文件的多页图像。
create(files, throw_exception_on_load_error)创建包含指定文件的多页图像。
create(image_options, width, height)使用指定的创建选项创建新图像。
create(image_options, width, height, pixels)创建一个来自提供的像素数组的 RasterImage 实例。

验证指定的宽度和高度是否与像素数据的维度匹配。
仅当库处于授权模式时才能使用此方法。
create(images)使用指定的图像作为页面创建新图像。
create(images, dispose_images)创建一个新图像,将指定的图像作为页面。
create(multipage_create_options)创建指定的多页创建选项。
create_from_files(files)创建包含指定文件的多页图像,将其作为延迟加载页面。
create_from_files(files, throw_exception_on_load_error)创建包含指定文件的多页图像,将其作为延迟加载页面。
create_from_images(images)使用指定的图像作为页面创建新图像。
create_from_images(images, dispose_images)创建一个新图像,将指定的图像作为页面。
create_with_frame(frame)初始化 TiffImage 类的新实例。
create_with_frames(frames)初始化 TiffImage 类的新实例。
crop(left_shift, right_shift, top_shift, bottom_shift)通过指定左、右、上、
下方向的位移对图像进行裁剪。此方法能够精确选择图像的所需部分,
高效去除不需要的区域并聚焦于关键内容。将此功能集成到您的图像处理
管道中,以在需要时提升图像的清晰度和构图。
crop(rectangle)使用指定的矩形区域裁剪图像,精确选择所需内容。将此方法集成到您的图像处理工作流中,
高效去除不需要的区域并聚焦关键细节,提升图像的整体清晰度和构图。
dither(dithering_method, bits_count)对当前图像执行抖动处理。
dither(dithering_method, bits_count, custom_palette)对当前图像执行抖动处理,以提升视觉质量并减少
颜色带状伪影。将此方法纳入您的图像处理工作流,
确保颜色过渡更平滑,从而改善整体图像外观和清晰度。
embed_digital_signature(password)根据提供的密码将数字签名嵌入图像的每一页。
filter(rectangle, options)在指定矩形区域内过滤内容,应用指定的图像
处理滤镜以增强或修改所选区域。将此方法
集成到您的图像操作工作流中,以实现针对性的增强或
转换,在您的应用程序中。
get_argb_32_pixel(x, y)获取图像的 32 位 ARGB 像素。
get_default_argb_32_pixels(rectangle)获取默认的 32 位 ARGB 像素数组。
get_default_options(args)获取默认选项。
get_default_pixels(rectangle, partial_pixel_loader)使用部分像素加载器获取默认像素数组。
get_default_raw_data(rectangle, partial_raw_data_loader, raw_data_settings)使用部分像素加载器获取默认原始数据数组。
get_default_raw_data(rectangle, raw_data_settings)获取默认原始数据数组。
get_file_format(file_path)获取文件格式。
get_file_format(stream)获取文件格式。
get_file_format_of_stream(stream)获取文件格式。
get_fitting_rectangle(rectangle, pixels, width, height)获取适合当前图像的矩形。
get_fitting_rectangle(rectangle, width, height)获取适合当前图像的矩形。
get_modify_date(use_default)获取资源图像最后修改的日期和时间。
get_original_options()检索源文件设置派生的选项,便于无缝
保留关键参数,如位深度和原始图像的其他重要属性。使用此方法在图像处理任务中保持保真度和一致性,确保获得最佳结果而不进行不必要的更改。
例如,如果我们加载一张每像素 1 位的黑白 PNG 图像,然后使用
DataStreamSupporter.save(file_path) 方法保存,它将生成每像素 8 位的 PNG 图像。
为避免这种情况并以每像素 1 位保存 PNG 图像,请使用此方法获取相应的保存选项并将其传递给 Image.save(file_path, options) 方法的第二个参数。
get_pixel(x, y)获取图像像素。
get_proportional_height(width, height, new_width)获取比例高度。
get_proportional_width(width, height, new_height)获取比例宽度。
get_serialized_stream(image_options, clipping_rectangle, page_number)转换为 aps。
get_skew_angle()获取倾斜角度。
此方法适用于扫描的文本文件,用于在扫描时确定倾斜角度。
grayscale()将图像转换为灰度表示,转化为
单通道图像,每个像素表示强度。将此方法集成到您的图像处理管道中,以简化分析并提升
与基于灰度的算法的兼容性,促进各种计算机
视觉和图像分析任务。
insert_frame(index, frame)在帧序列中指定索引处插入新帧,确保
对帧排列的精确控制。使用此方法有效管理帧
序列,促进图像内容的动态操作和组织。
is_digital_signed(password, percentage_threshold)使用提供的密码和阈值执行快速检查,以确定图像是否已数字签名。
load(file_path)从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
load(file_path, load_options)从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
load(stream)从指定的流加载新图像。
load(stream, load_options)从指定的流加载新图像。
load_argb_32_pixels(rectangle)加载 32 位 ARGB 像素。
load_argb_64_pixels(rectangle)加载 64 位 ARGB 像素。
load_cmyk_32_pixels(rectangle)加载 CMYK 格式的像素。
load_cmyk_pixels(rectangle)加载 CMYK 格式的像素。
此方法已弃用。请使用更有效的 RasterImage.load_cmyk_32_pixels(rectangle) 方法。
load_partial_argb_32_pixels(rectangle, partial_pixel_loader)部分加载 32 位 ARGB 像素(按块)。
load_partial_argb_64_pixels(rectangle, partial_pixel_loader)按包部分加载 64 位 ARGB 像素。
load_partial_pixels(desired_rectangle, pixel_loader)按包部分加载像素。
load_pixels(rectangle)加载像素。
load_raw_data(rectangle, dest_image_bounds, raw_data_settings, raw_data_loader)加载原始数据。
load_raw_data(rectangle, raw_data_settings, raw_data_loader)加载原始数据。
load_stream(stream)从指定的流加载新图像。
load_stream_with_options(stream, load_options)从指定的流加载新图像。
load_with_options(file_path, load_options)从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。
normalize_angle()归一化角度。
此方法适用于扫描的文本文档,以消除倾斜扫描。
此方法使用 RasterImage.get_skew_angle()RasterImage.rotate(angle) 方法。
normalize_angle(resize_proportionally, background_color)使用专为扫描文本文件设计的 NormalizeAngle 方法
矫正倾斜扫描,确保准确对齐。将此功能无缝
集成到您的文本处理工作流中,以提升
文档可读性和质量,改善文本识别
与分析任务的整体效率。
此方法使用 RasterImage.get_skew_angle()TiffImage.rotate(angle, resize_proportionally, background_color) 方法。
normalize_histogram()归一化图像直方图 — 调整像素值以使用全部可用范围。
read_argb_32_scan_line(scan_line_index)按指定的扫描线索引读取整条扫描线。
read_scan_line(scan_line_index)按指定的扫描线索引读取整条扫描线。
remove_frame(frame)高效移除图像序列中指定的帧,促进
在您的应用程序中实现流畅的帧管理。将此功能
集成以提升帧操作的精确性和灵活性,确保图像内容的无缝
组织和呈现。
remove_frame(index)通过索引移除帧。
remove_frame_by_index(index)通过索引移除帧。
remove_metadata()通过将此
IHasXmpData.xmp_data
IHasExifData.exif_data 的值设为 None 来移除该图像实例的元数据。
replace_argb(old_color_argb, old_color_diff, new_color_argb)在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。
replace_color(old_color, old_color_diff, new_color)在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。
replace_color(old_color_argb, old_color_diff, new_color_argb)在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。
replace_frame(index, new_frame)在指定位置用另一帧替换该帧,操作无缝
,促进图像序列中的动态帧管理。将此
方法集成以提升帧操作的灵活性和精确性,确保
在您的应用程序中实现图像内容的最佳组织和呈现。
replace_non_transparent_colors(new_color)将所有非透明颜色替换为新颜色,并保留原始 alpha 值以保持平滑边缘。
注意:如果在没有透明度的图像上使用,它将把所有颜色替换为单一颜色。
replace_non_transparent_colors(new_color_argb)将所有非透明颜色替换为新颜色,并保留原始 alpha 值以保持平滑边缘。
注意:如果在没有透明度的图像上使用,它将把所有颜色替换为单一颜色。
resize(new_width, new_height)调整图像大小。使用默认的 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE
resize(new_width, new_height, resize_type)对图像执行等比例缩放操作,保持宽高比
同时调整尺寸。使用此方法在您的应用程序中动态缩放图像,
确保内容完整性的视觉表现一致。
等比例缩放将根据 newWidth/width 和 newHeight/height 的比例对每帧进行调整。
resize(new_width, new_height, settings)根据指定设置调整图像大小,允许对尺寸、宽高比和缩放行为进行精确
控制。将此方法集成到您的图像处理工作流中,以实现针对应用程序特定需求的自定义缩放操作。
resize_by_settings(new_width, new_height, settings)调整图像大小。
resize_by_type(new_width, new_height, resize_type)调整图像大小。
resize_height_proportionally(new_height)按比例调整高度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE
resize_height_proportionally(new_height, resize_type)对图像高度进行等比例调整,保持宽高比
以确保视觉完整性一致。使用此方法在您的应用程序中动态缩放图像,
确保在各种平台和设备上实现最佳显示,而不影响内容质量。
resize_height_proportionally(new_height, settings)按比例调整高度。
resize_height_proportionally_settings(new_height, settings)按比例调整高度。
resize_proportional(new_width, new_height, resize_type)对图像执行等比例缩放操作,保持宽高比
同时调整尺寸。使用此方法在您的应用程序中动态缩放图像,
确保内容完整性的视觉表现一致。
等比例缩放将根据 newWidth/width 和 newHeight/height 的比例对每帧进行调整。
resize_width_proportionally(new_width)按比例调整宽度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE
resize_width_proportionally(new_width, resize_type)在保持宽高比的前提下调整图像宽度,确保
等比例缩放以获得最佳视觉呈现。利用此方法在您的应用程序中
动态缩放图像,促进在各种显示环境下的一致且
美观的渲染。
resize_width_proportionally(new_width, settings)按比例调整宽度。
resize_width_proportionally_settings(new_width, settings)按比例调整宽度。
rotate(angle)围绕中心旋转图像。
rotate(angle, resize_proportionally, background_color)围绕图像中心点按指定角度旋转图像,实现精确
方向调整。将此功能纳入您的图像处理
管道,以实现准确的变换,确保视觉内容的最佳对齐和
呈现。
rotate_flip(rotate_flip_type)对活动帧执行旋转、翻转或两者的组合操作。此方法允许对图像序列中的单个帧进行精确操作,提升图像编辑和构图的灵活性。
rotate_flip_all(rotate_flip)旋转并翻转全部。
save()将图像数据保存到底层流中。
save(file_path)将图像保存到指定的文件位置。
save(file_path, options)根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
save(file_path, options, bounds_rectangle)根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
save(file_path, over_write)将对象的数据保存到指定的文件位置。
save(stream)将对象的数据保存到指定的流中。
save(stream, options_base)根据保存选项,将图像的数据保存到指定流中的指定文件格式。
save(stream, options_base, bounds_rectangle)根据保存选项,将图像的数据保存到指定流中的指定文件格式。
save_argb_32_pixels(rectangle, pixels)保存 32 位 ARGB 像素。
save_cmyk_32_pixels(rectangle, pixels)保存像素。
save_cmyk_pixels(rectangle, pixels)保存像素。
此方法已弃用。请使用更有效的 RasterImage.save_cmyk_32_pixels(rectangle, pixels) 方法。
save_pixels(rectangle, pixels)保存像素的内部主要内容。
save_raw_data(data, data_offset, rectangle, raw_data_settings)保存原始数据。
save_to_stream(stream)将图像保存到流中
save_to_stream_with_options(stream, options_base)根据保存选项,将图像的数据保存到指定流中的指定文件格式。
save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)根据保存选项,将图像的数据保存到指定流中的指定文件格式。
save_with_options(file_path, options)根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
save_with_options_rect(file_path, options, bounds_rectangle)根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。
set_argb_32_pixel(x, y, argb_32_color)为指定位置设置图像的 32 位 ARGB 像素。
set_palette(palette, update_colors)设置图像调色板。
set_pixel(x, y, color)为指定位置设置图像像素。
set_resolution(dpi_x, dpi_y)为指定的 RasterImage 建立分辨率,能够
精确控制图像渲染和显示属性。集成此
功能以优化视觉输出并确保与各种
输出设备和平台的兼容性,提升整体用户体验。
try_set_metadata(metadata)尝试设置一个 metadata 实例,前提是此 Image 实例支持并实现 IImageMetadataFormat 实例。
write_argb_32_scan_line(scan_line_index, argb_32_pixels)将整条扫描线写入指定的扫描线索引。
write_scan_line(scan_line_index, pixels)将整条扫描线写入指定的扫描线索引。

Constructor: TiffImage(frame)

 TiffImage(frame) 

初始化 TiffImage 类的新对象,指定
帧参数。此构造函数有助于创建 TiffImage
实例,允许开发者指定要加载或处理的帧,
简化其应用程序中的 Tiff 图像处理任务。

Parameters:

参数TypeDescription
frameTiffFrame用于初始化图像的 tiff 帧。

Constructor: TiffImage(frames)

 TiffImage(frames) 

创建 TiffImage 类的新实例,提供一个
帧列表作为参数。此构造函数使得能够使用多个帧初始化 TiffImage
对象,促进在软件应用中高效处理和处理
TIFF 图像序列。

Parameters:

参数TypeDescription
framesTiffFrame[]帧。

Property: has_alpha

确定图像是否具有 alpha 通道,为渲染和合成操作提供关键信息
。将此功能集成到视觉处理工作流中,以优化
流程,确保对透明元素的准确
表现和操作。

See also:

Example # 1: The following example loads a TIFF image and prints information about raw dat…

Method: add(image)

 add(image) 

将指定图像的帧无缝添加到当前帧中,
整合其内容并提升组合灵活性。将此方法集成到您的应用程序中,
简化帧管理和操作,
促进对多帧图像的高效处理。

Parameters:

参数TypeDescription
imageTiffImage源图像。

Method: add_frame(frame)

 add_frame(frame) 

将指定帧无缝合并到图像中,扩展其内容和多样性。
利用此方法提升图像组合和管理,
使您的应用程序能够高效处理多帧图像。

Parameters:

参数TypeDescription
frameTiffFrame要添加的帧。

Method: add_frames(frames)

 add_frames(frames) 

将帧数组无缝集成到图像中,丰富其内容和多样性。
利用此方法提升图像组合和管理,
使您的应用程序能够高效处理多帧图像。

Parameters:

参数TypeDescription
framesTiffFrame[]要添加的帧数组

Method: add_page(page)

 add_page(page) 

将新页面无缝合并到现有图像中,扩展其内容
和多功能性。使用此方法可提升文档构成和
管理,使您的应用程序能够高效处理多页图像。

Parameters:

参数TypeDescription
pageRasterImage要添加的页面。

Method: adjust_brightness(brightness)

 adjust_brightness(brightness) 

实现对图像的 brightness 调整,允许
修改整体亮度水平。将此方法整合到您的图像处理工作流中,
以提升可见性并改善
应用程序中图像的视觉质量。

Parameters:

参数TypeDescription
亮度int亮度值。

See also:

Example # 1: The following example performs brightness correction of a TIFF image.

Method: adjust_contrast(contrast)

 adjust_contrast(contrast) 

提升 Image 实例的对比度,
放大其亮暗区域的差异。
将此功能集成,以改善图像的视觉清晰度和整体质量,
为您的应用程序提供更佳的图像表现。

Parameters:

参数TypeDescription
对比度float对比度值(范围为 [-100; 100])

See also:

Example # 1: The following example performs contrast correction of a TIFF image.

Method: adjust_gamma(gamma)

 adjust_gamma(gamma) 

对图像应用伽马校正,调整像素强度以实现
所需的色彩平衡。将此方法纳入您的图像处理
工作流,以提升视觉质量并提高后续
分析或显示任务的准确性。

Parameters:

参数TypeDescription
伽马float红、绿、蓝通道的伽马系数

See also:

Example # 1: The following example performs gamma-correction of a TIFF image.

Method: adjust_gamma(gamma_red, gamma_green, gamma_blue)

 adjust_gamma(gamma_red, gamma_green, gamma_blue) 

使用红、
绿和蓝通道的单独系数对图像进行伽马校正,以实现对色彩平衡
和对比度的精细调节。将此方法集成到您的图像处理管道中,
实现对颜色渲染的精确控制,并在您的应用程序中提升视觉保真度。

Parameters:

参数TypeDescription
gamma_redfloat红色通道的伽马系数
gamma_greenfloat绿色通道的伽马系数
gamma_bluefloat蓝色通道系数的 Gamma

See also:

Example # 1: The following example performs gamma-correction of a TIFF image applying diff…

Method: analyze_percentage_digital_signature(password)

 analyze_percentage_digital_signature(password) 

计算提取数据与原始密码之间的相似度百分比。

Parameters:

参数TypeDescription
密码string用于提取嵌入数据的密码。

Returns

TypeDescription
int百分比相似度值。

Method: binarize_bradley(brightness_difference)

 binarize_bradley(brightness_difference) 

使用 Bradley 的自适应阈值算法和积分图阈值进行图像二值化

Parameters:

参数TypeDescription
brightness_differencefloat像素与以该像素为中心的 s x s 像素窗口的平均值之间的亮度差

Method: binarize_bradley(brightness_difference, window_size)

 binarize_bradley(brightness_difference, window_size) 

在图像上实现二值化,采用 Bradley 自适应阈值
算法结合积分图阈值。此方法根据图像邻域动态计算
局部阈值,提升对不同光照条件的适应性,并确保后续
处理任务的稳健分割。

Parameters:

参数TypeDescription
brightness_differencefloat像素与以该像素为中心的 s x s 像素窗口的平均值之间的亮度差
window_sizeint以该像素为中心的 s x s 像素窗口的大小

See also:

Example # 1: The following example binarizes a TIFF image with Bradley’s adaptive threshol…

Method: binarize_fixed(threshold)

 binarize_fixed(threshold) 

使用预定义阈值对图像进行二值化,将其转换为
前景和背景区域明确的二值图像。将此方法纳入您的图像处理工作流,以便于分割和特征
提取任务,提升图像分析的准确性和效率。

Parameters:

参数TypeDescription
阈值System.Byte阈值。如果像素的对应灰度值大于阈值,则赋值为
255,否则为 0。

See also:

Example # 1: The following example binarizes a TIFF image with the predefined threshold. B…

Method: blend(origin, overlay, overlay_alpha)

 blend(origin, overlay, overlay_alpha) 

将此图像实例与 overlay 图像混合。

Parameters:

参数TypeDescription
originPoint背景图像混合的原点。
overlayRasterImage覆盖图像。
overlay_alphaSystem.Byte覆盖的 alpha。

Method: blend(origin, overlay, overlay_area, overlay_alpha)

 blend(origin, overlay, overlay_area, overlay_alpha) 

将此图像实例与 overlay 图像混合。

Parameters:

参数TypeDescription
originPoint背景图像混合的原点。
overlayRasterImage覆盖图像。
overlay_areaRectangle覆盖区域。
overlay_alphaSystem.Byte覆盖的 alpha。

Method: can_load(file_path) [static]

 can_load(file_path) 

确定是否可以从指定的文件路径加载图像。

Parameters:

参数TypeDescription
file_pathstring文件路径。

Returns

TypeDescription
booltrue 如果可以从指定文件加载图像;否则为 false

Method: can_load(file_path, load_options) [static]

 can_load(file_path, load_options) 

确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。

Parameters:

参数TypeDescription
file_pathstring文件路径。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
booltrue 如果可以从指定文件加载图像;否则为 false

Method: can_load(stream) [static]

 can_load(stream) 

确定是否可以从指定的流加载图像。

Parameters:

参数TypeDescription
_io.BufferedRandom要加载的流。

Returns

TypeDescription
booltrue 如果可以从指定流加载图像;否则为 false

Method: can_load(stream, load_options) [static]

 can_load(stream, load_options) 

确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions

Parameters:

参数TypeDescription
_io.BufferedRandom要加载的流。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
booltrue 如果可以从指定流加载图像;否则为 false

Method: can_load_stream(stream) [static]

 can_load_stream(stream) 

确定是否可以从指定的流加载图像。

Parameters:

参数TypeDescription
_io.BufferedRandom要加载的流。

Returns

TypeDescription
booltrue 如果可以从指定流加载图像;否则为 false

Method: can_load_stream_with_options(stream, load_options) [static]

 can_load_stream_with_options(stream, load_options) 

确定是否可以从指定的流加载图像,并可选地使用指定的 loadOptions

Parameters:

参数TypeDescription
_io.BufferedRandom要加载的流。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
booltrue 如果可以从指定流加载图像;否则为 false

Method: can_load_with_options(file_path, load_options) [static]

 can_load_with_options(file_path, load_options) 

确定是否可以从指定的文件路径加载图像,并可选地使用指定的打开选项。

Parameters:

参数TypeDescription
file_pathstring文件路径。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
booltrue 如果可以从指定文件加载图像;否则为 false

Method: can_save(options)

 can_save(options) 

确定是否可以将图像保存为由传入的保存选项表示的指定文件格式。

Parameters:

参数TypeDescription
optionsImageOptionsBase要使用的保存选项。

Returns

TypeDescription
booltrue 如果图像可以保存为由传入的保存选项表示的指定文件格式;否则为 false

Method: create(files) [static]

 create(files) 

创建包含指定文件的多页图像。

Parameters:

参数TypeDescription
文件string[]文件。

Returns

TypeDescription
Image多页图像

Method: create(files, throw_exception_on_load_error) [static]

 create(files, throw_exception_on_load_error) 

创建包含指定文件的多页图像。

Parameters:

参数TypeDescription
文件string[]文件。
throw_exception_on_load_errorbool如果设置为 true [throw exception on load error]。

Returns

TypeDescription
Image多页图像

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

 create(image_options, width, height) 

使用指定的创建选项创建新图像。

Parameters:

参数TypeDescription
image_optionsImageOptionsBase图像选项。
widthint宽度。
heightint高度。

Returns

TypeDescription
Image新创建的图像。

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

 create(image_options, width, height, pixels) 

创建一个来自提供的像素数组的 RasterImage 实例。

验证指定的宽度和高度是否与像素数据的维度匹配。
仅当库处于授权模式时才能使用此方法。

Parameters:

参数TypeDescription
image_optionsImageOptionsBase用于创建 RasterImage 的选项。
widthintRasterImage 的宽度。
heightintRasterImage 的高度。
像素int[]用于填充图像的像素值数组。

Returns

TypeDescription
Image使用提供的像素数据填充的 RasterImage

Method: create(images) [static]

 create(images) 

使用指定的图像作为页面创建新图像。

Parameters:

参数TypeDescription
imagesImage[]图像。

Returns

TypeDescription
ImageImage 作为 IMultipageImage

Method: create(images, dispose_images) [static]

 create(images, dispose_images) 

创建一个新图像,将指定的图像作为页面。

Parameters:

参数TypeDescription
imagesImage[]图像。
dispose_imagesbool如果设置为 true [dispose images]。

Returns

TypeDescription
ImageImage 作为 IMultipageImage

Method: create(multipage_create_options) [static]

 create(multipage_create_options) 

创建指定的多页创建选项。

Parameters:

参数TypeDescription
multipage_create_optionsMultipageCreateOptions多页创建选项。

Returns

TypeDescription
Image多页图像

Method: create_from_files(files) [static]

 create_from_files(files) 

创建包含指定文件的多页图像,将其作为延迟加载页面。

Parameters:

参数TypeDescription
文件string[]文件。

Returns

TypeDescription
Image多页图像

Method: create_from_files(files, throw_exception_on_load_error) [static]

 create_from_files(files, throw_exception_on_load_error) 

创建包含指定文件的多页图像,将其作为延迟加载页面。

Parameters:

参数TypeDescription
文件string[]文件。
throw_exception_on_load_errorbool如果设置为 true 抛出加载错误异常。

Returns

TypeDescription
Image多页图像

Method: create_from_images(images) [static]

 create_from_images(images) 

使用指定的图像作为页面创建新图像。

Parameters:

参数TypeDescription
imagesImage[]图像。

Returns

TypeDescription
ImageImage 作为 IMultipageImage

Method: create_from_images(images, dispose_images) [static]

 create_from_images(images, dispose_images) 

创建一个新图像,将指定的图像作为页面。

Parameters:

参数TypeDescription
imagesImage[]图像。
dispose_imagesbool如果设置为 true [dispose images]。

Returns

TypeDescription
ImageImage 作为 IMultipageImage

Method: create_with_frame(frame) [static]

 create_with_frame(frame) 

初始化 TiffImage 类的新实例。

Parameters:

参数TypeDescription
frameTiffFrame用于初始化图像的 tiff 帧。

Returns

TypeDescription
TiffImage

Method: create_with_frames(frames) [static]

 create_with_frames(frames) 

初始化 TiffImage 类的新实例。

Parameters:

参数TypeDescription
framesTiffFrame[]帧。

Returns

TypeDescription
TiffImage

Method: crop(left_shift, right_shift, top_shift, bottom_shift)

 crop(left_shift, right_shift, top_shift, bottom_shift) 

通过指定左、右、上、
下方向的位移对图像进行裁剪。此方法能够精确选择图像的所需部分,
高效去除不需要的区域并聚焦于关键内容。将此功能集成到您的图像处理
管道中,以在需要时提升图像的清晰度和构图。

Parameters:

参数TypeDescription
left_shiftint左移。
right_shiftint右移。
top_shiftint上移。
bottom_shiftint下移。

See also:

Example # 1: The following example crops a TIFF image. The cropping area is specified via …

Method: crop(rectangle)

 crop(rectangle) 

使用指定的矩形区域裁剪图像,精确选择所需内容。将此方法集成到您的图像处理工作流中,
高效去除不需要的区域并聚焦关键细节,提升图像的整体清晰度和构图。

Parameters:

参数TypeDescription
rectangleRectangle矩形。

See also:

Example # 1: The following example crops a TIFF image. The cropping area is be specified v…

Method: dither(dithering_method, bits_count)

 dither(dithering_method, bits_count) 

对当前图像执行抖动处理。

Parameters:

参数TypeDescription
dithering_methodDitheringMethod抖动方法。
bits_countint用于抖动的最终位计数。

Method: dither(dithering_method, bits_count, custom_palette)

 dither(dithering_method, bits_count, custom_palette) 

对当前图像执行抖动处理,以提升视觉质量并减少
颜色带状伪影。将此方法纳入您的图像处理工作流,
确保颜色过渡更平滑,从而改善整体图像外观和清晰度。

Parameters:

参数TypeDescription
dithering_methodDitheringMethod抖动方法。
bits_countint用于抖动的最终位计数。
custom_paletteIColorPalette用于抖动的自定义调色板。

Method: embed_digital_signature(password)

 embed_digital_signature(password) 

根据提供的密码将数字签名嵌入图像的每一页。

Parameters:

参数TypeDescription
密码string用于生成数字签名数据的密码

Method: filter(rectangle, options)

 filter(rectangle, options) 

在指定矩形区域内过滤内容,应用指定的图像
处理滤镜以增强或修改所选区域。将此方法
集成到您的图像操作工作流中,以实现针对性的增强或
转换,在您的应用程序中。

Parameters:

参数TypeDescription
rectangleRectangle矩形。
optionsFilterOptionsBase选项。

Method: get_argb_32_pixel(x, y)

 get_argb_32_pixel(x, y) 

获取图像的 32 位 ARGB 像素。

Parameters:

参数TypeDescription
xint像素的 x 位置。
yint像素的 y 位置。

Returns

TypeDescription
int指定位置的 32 位 ARGB 像素。

Method: get_default_argb_32_pixels(rectangle)

 get_default_argb_32_pixels(rectangle) 

获取默认的 32 位 ARGB 像素数组。

Parameters:

参数TypeDescription
rectangleRectangle用于获取像素的矩形。

Returns

TypeDescription
int[]默认像素数组。

Method: get_default_options(args)

 get_default_options(args) 

获取默认选项。

Parameters:

参数TypeDescription
argsSystem.Object参数。

Returns

TypeDescription
ImageOptionsBase默认选项

Method: get_default_pixels(rectangle, partial_pixel_loader)

 get_default_pixels(rectangle, partial_pixel_loader) 

使用部分像素加载器获取默认像素数组。

Parameters:

参数TypeDescription
rectangleRectangle用于获取像素的矩形。
partial_pixel_loaderIPartialArgb32PixelLoader部分像素加载器。

Method: get_default_raw_data(rectangle, partial_raw_data_loader, raw_data_settings)

 get_default_raw_data(rectangle, partial_raw_data_loader, raw_data_settings) 

使用部分像素加载器获取默认原始数据数组。

Parameters:

参数TypeDescription
rectangleRectangle用于获取像素的矩形。
partial_raw_data_loaderIPartialRawDataLoader部分原始数据加载器。
raw_data_settingsRawDataSettings原始数据设置。

Method: get_default_raw_data(rectangle, raw_data_settings)

 get_default_raw_data(rectangle, raw_data_settings) 

获取默认原始数据数组。

Parameters:

参数TypeDescription
rectangleRectangle用于获取原始数据的矩形。
raw_data_settingsRawDataSettings原始数据设置。

Returns

TypeDescription
System.Byte默认原始数据数组。

Method: get_file_format(file_path) [static]

 get_file_format(file_path) 

获取文件格式。

Parameters:

参数TypeDescription
file_pathstring文件路径。

Returns

TypeDescription
FileFormat确定的文件格式。

Method: get_file_format(stream) [static]

 get_file_format(stream) 

获取文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom该流。

Returns

TypeDescription
FileFormat确定的文件格式。

Method: get_file_format_of_stream(stream) [static]

 get_file_format_of_stream(stream) 

获取文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom该流。

Returns

TypeDescription
FileFormat确定的文件格式。

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

 get_fitting_rectangle(rectangle, pixels, width, height) 

获取适合当前图像的矩形。

Parameters:

参数TypeDescription
rectangleRectangle用于获取合适矩形的矩形。
像素int[]32 位 ARGB 像素。
widthint对象宽度。
heightint对象高度。

Returns

TypeDescription
Rectangle适配矩形,若未找到适配矩形则抛出异常。

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

 get_fitting_rectangle(rectangle, width, height) 

获取适合当前图像的矩形。

Parameters:

参数TypeDescription
rectangleRectangle用于获取合适矩形的矩形。
widthint对象宽度。
heightint对象高度。

Returns

TypeDescription
Rectangle适配矩形,若未找到适配矩形则抛出异常。

Method: get_modify_date(use_default)

 get_modify_date(use_default) 

获取资源图像最后修改的日期和时间。

Parameters:

参数TypeDescription
use_defaultbool如果设置为 true,则使用 FileInfo 中的信息作为默认值。

Returns

TypeDescription
System.DateTime资源图像上次修改的日期和时间。

Method: get_original_options()

 get_original_options() 

检索源文件设置派生的选项,便于无缝
保留关键参数,如位深度和原始图像的其他重要属性。使用此方法在图像处理任务中保持保真度和一致性,确保获得最佳结果而不进行不必要的更改。
例如,如果我们加载一张每像素 1 位的黑白 PNG 图像,然后使用
DataStreamSupporter.save(file_path) 方法保存,它将生成每像素 8 位的 PNG 图像。
为避免这种情况并以每像素 1 位保存 PNG 图像,请使用此方法获取相应的保存选项并将其传递给 Image.save(file_path, options) 方法的第二个参数。

Returns

TypeDescription
ImageOptionsBase基于原始文件设置的选项。

Method: get_pixel(x, y)

 get_pixel(x, y) 

获取图像像素。

Parameters:

参数TypeDescription
xint像素的 x 位置。
yint像素的 y 位置。

Returns

TypeDescription
Color指定位置的像素颜色。

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

 get_proportional_height(width, height, new_width) 

获取比例高度。

Parameters:

参数TypeDescription
widthint宽度。
heightint高度。
new_widthint新的宽度。

Returns

TypeDescription
int比例高度。

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

 get_proportional_width(width, height, new_height) 

获取比例宽度。

Parameters:

参数TypeDescription
widthint宽度。
heightint高度。
new_heightint新的高度。

Returns

TypeDescription
int比例宽度。

Method: get_serialized_stream(image_options, clipping_rectangle, page_number)

 get_serialized_stream(image_options, clipping_rectangle, page_number) 

转换为 aps。

Parameters:

参数TypeDescription
image_optionsImageOptionsBase图像选项。
clipping_rectangleRectangle裁剪矩形。
page_numberint[]页码。

Returns

TypeDescription
_io.BufferedRandom序列化流

Method: get_skew_angle()

 get_skew_angle() 

获取倾斜角度。
此方法适用于扫描的文本文件,用于在扫描时确定倾斜角度。

Returns

TypeDescription
float倾斜角度(单位:度)。

Method: insert_frame(index, frame)

 insert_frame(index, frame) 

在帧序列中指定索引处插入新帧,确保
对帧排列的精确控制。使用此方法有效管理帧
序列,促进图像内容的动态操作和组织。

Parameters:

参数TypeDescription
indexintframe 的索引。
frameTiffFrame用于插入的帧。

Method: is_digital_signed(password, percentage_threshold)

 is_digital_signed(password, percentage_threshold) 

使用提供的密码和阈值执行快速检查,以确定图像是否已数字签名。

Parameters:

参数TypeDescription
密码string用于检查签名的密码。
percentage_thresholdint阈值(百分比)[0-100] 用于确定图像是否被视为已签名。
如果未指定,将使用默认阈值(75)。

Returns

TypeDescription
bool如果图像已签名则为 true,否则为 false。

Method: load(file_path) [static]

 load(file_path) 

从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。

Parameters:

参数TypeDescription
file_pathstring加载图像的文件路径或 URL。

Returns

TypeDescription
Image已加载的图像。

Method: load(file_path, load_options) [static]

 load(file_path, load_options) 

从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。

Parameters:

参数TypeDescription
file_pathstring加载图像的文件路径或 URL。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
Image已加载的图像。

Method: load(stream) [static]

 load(stream) 

从指定的流加载新图像。

Parameters:

参数TypeDescription
_io.BufferedRandom加载图像的流。

Returns

TypeDescription
Image已加载的图像。

Method: load(stream, load_options) [static]

 load(stream, load_options) 

从指定的流加载新图像。

Parameters:

参数TypeDescription
_io.BufferedRandom加载图像的流。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
Image已加载的图像。

Method: load_argb_32_pixels(rectangle)

 load_argb_32_pixels(rectangle) 

加载 32 位 ARGB 像素。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。

Returns

TypeDescription
int[]已加载的 32 位 ARGB 像素数组。

Method: load_argb_64_pixels(rectangle)

 load_argb_64_pixels(rectangle) 

加载 64 位 ARGB 像素。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。

Returns

TypeDescription
int[]已加载的 64 位 ARGB 像素数组。

Method: load_cmyk_32_pixels(rectangle)

 load_cmyk_32_pixels(rectangle) 

加载 CMYK 格式的像素。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。

Returns

TypeDescription
int[]已加载的 CMYK 像素以 32 位整数值呈现。

Method: load_cmyk_pixels(rectangle)

 load_cmyk_pixels(rectangle) 

加载 CMYK 格式的像素。
此方法已弃用。请使用更有效的 RasterImage.load_cmyk_32_pixels(rectangle) 方法。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。

Returns

TypeDescription
CmykColor[]已加载的 CMYK 像素数组。

Method: load_partial_argb_32_pixels(rectangle, partial_pixel_loader)

 load_partial_argb_32_pixels(rectangle, partial_pixel_loader) 

部分加载 32 位 ARGB 像素(按块)。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。
partial_pixel_loaderIPartialArgb32PixelLoader部分像素加载器。

Method: load_partial_argb_64_pixels(rectangle, partial_pixel_loader)

 load_partial_argb_64_pixels(rectangle, partial_pixel_loader) 

按包部分加载 64 位 ARGB 像素。

Parameters:

参数TypeDescription
rectangleRectangle所需的矩形。
partial_pixel_loaderIPartialArgb64PixelLoader64 位 ARGB 像素加载器。

Method: load_partial_pixels(desired_rectangle, pixel_loader)

 load_partial_pixels(desired_rectangle, pixel_loader) 

按包部分加载像素。

Parameters:

参数TypeDescription
desired_rectangleRectangle所需的矩形。
pixel_loaderIPartialPixelLoader像素加载器。

Method: load_pixels(rectangle)

 load_pixels(rectangle) 

加载像素。

Parameters:

参数TypeDescription
rectangleRectangle加载像素的矩形。

Returns

TypeDescription
Color[]已加载的像素数组。

Method: load_raw_data(rectangle, dest_image_bounds, raw_data_settings, raw_data_loader)

 load_raw_data(rectangle, dest_image_bounds, raw_data_settings, raw_data_loader) 

加载原始数据。

Parameters:

参数TypeDescription
rectangleRectangle用于加载原始数据的矩形。
dest_image_boundsRectangle目标图像边界。
raw_data_settingsRawDataSettings用于已加载数据的原始数据设置。注意,如果数据不是指定的格式,则会执行数据转换。
raw_data_loaderIPartialRawDataLoader原始数据加载器。

Method: load_raw_data(rectangle, raw_data_settings, raw_data_loader)

 load_raw_data(rectangle, raw_data_settings, raw_data_loader) 

加载原始数据。

Parameters:

参数TypeDescription
rectangleRectangle用于加载原始数据的矩形。
raw_data_settingsRawDataSettings用于已加载数据的原始数据设置。注意,如果数据不是指定的格式,则会执行数据转换。
raw_data_loaderIPartialRawDataLoader原始数据加载器。

Method: load_stream(stream) [static]

 load_stream(stream) 

从指定的流加载新图像。

Parameters:

参数TypeDescription
_io.BufferedRandom加载图像的流。

Returns

TypeDescription
Image已加载的图像。

Method: load_stream_with_options(stream, load_options) [static]

 load_stream_with_options(stream, load_options) 

从指定的流加载新图像。

Parameters:

参数TypeDescription
_io.BufferedRandom加载图像的流。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
Image已加载的图像。

Method: load_with_options(file_path, load_options) [static]

 load_with_options(file_path, load_options) 

从指定的文件路径或 URL 加载新图像。
如果 filePath 是文件路径,方法仅打开该文件。
如果 filePath 是 URL,方法会下载文件,将其存为临时文件,然后打开它。

Parameters:

参数TypeDescription
file_pathstring加载图像的文件路径或 URL。
load_optionsLoadOptions加载选项。

Returns

TypeDescription
Image已加载的图像。

Method: normalize_angle(resize_proportionally, background_color)

 normalize_angle(resize_proportionally, background_color) 

使用专为扫描文本文件设计的 NormalizeAngle 方法
矫正倾斜扫描,确保准确对齐。将此功能无缝
集成到您的文本处理工作流中,以提升
文档可读性和质量,改善文本识别
与分析任务的整体效率。
此方法使用 RasterImage.get_skew_angle()TiffImage.rotate(angle, resize_proportionally, background_color) 方法。

Parameters:

参数TypeDescription
resize_proportionallybool如果设置为 true,图像尺寸将根据旋转矩形(角点)投影进行更改;否则保持尺寸不变,仅旋转内部图像内容。
background_colorColor背景颜色。

Method: read_argb_32_scan_line(scan_line_index)

 read_argb_32_scan_line(scan_line_index) 

按指定的扫描线索引读取整条扫描线。

Parameters:

参数TypeDescription
scan_line_indexint扫描线的零基索引。

Returns

TypeDescription
int[]扫描线 32 位 ARGB 颜色值数组。

Method: read_scan_line(scan_line_index)

 read_scan_line(scan_line_index) 

按指定的扫描线索引读取整条扫描线。

Parameters:

参数TypeDescription
scan_line_indexint扫描线的零基索引。

Returns

TypeDescription
Color[]扫描线像素颜色值数组。

Method: remove_frame(frame)

 remove_frame(frame) 

高效移除图像序列中指定的帧,促进
在您的应用程序中实现流畅的帧管理。将此功能
集成以提升帧操作的精确性和灵活性,确保图像内容的无缝
组织和呈现。

Parameters:

参数TypeDescription
frameTiffFrame要移除的帧。

Method: remove_frame(index)

 remove_frame(index) 

通过索引移除帧。

Parameters:

参数TypeDescription
indexint要移除的帧的索引。

Returns

TypeDescription
TiffFrame已移除的帧。

Method: remove_frame_by_index(index)

 remove_frame_by_index(index) 

通过索引移除帧。

Parameters:

参数TypeDescription
indexint要移除的帧的索引。

Returns

TypeDescription
TiffFrame已移除的帧。

Method: replace_argb(old_color_argb, old_color_diff, new_color_argb)

 replace_argb(old_color_argb, old_color_diff, new_color_argb) 

在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。

Parameters:

参数TypeDescription
old_color_argbint要替换的旧颜色 ARGB 值。
old_color_diffSystem.Byte允许的旧颜色差异,以便能够扩大替换颜色的色调。
new_color_argbint用于替换旧颜色的新颜色 ARGB 值。

Method: replace_color(old_color, old_color_diff, new_color)

 replace_color(old_color, old_color_diff, new_color) 

在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。

Parameters:

参数TypeDescription
old_colorColor
old_color_diffSystem.Byte允许的旧颜色差异,以便能够扩大替换颜色的色调。
new_colorColor

Method: replace_color(old_color_argb, old_color_diff, new_color_argb)

 replace_color(old_color_argb, old_color_diff, new_color_argb) 

在允许的差异范围内将一种颜色替换为另一种颜色,并保留原始 alpha 值以保持平滑边缘。

Parameters:

参数TypeDescription
old_color_argbint要替换的旧颜色 ARGB 值。
old_color_diffSystem.Byte允许的旧颜色差异,以便能够扩大替换颜色的色调。
new_color_argbint用于替换旧颜色的新颜色 ARGB 值。

Method: replace_frame(index, new_frame)

 replace_frame(index, new_frame) 

在指定位置用另一帧替换该帧,操作无缝
,促进图像序列中的动态帧管理。将此
方法集成以提升帧操作的灵活性和精确性,确保
在您的应用程序中实现图像内容的最佳组织和呈现。

Parameters:

参数TypeDescription
indexint基于零的帧位置。
new_frameTiffFrame用于替换指定 index 处帧的帧。

Returns

TypeDescription
TiffFrame已移除的帧。

Method: replace_non_transparent_colors(new_color)

 replace_non_transparent_colors(new_color) 

将所有非透明颜色替换为新颜色,并保留原始 alpha 值以保持平滑边缘。
注意:如果在没有透明度的图像上使用,它将把所有颜色替换为单一颜色。

Parameters:

参数TypeDescription
new_colorColor

Method: replace_non_transparent_colors(new_color_argb)

 replace_non_transparent_colors(new_color_argb) 

将所有非透明颜色替换为新颜色,并保留原始 alpha 值以保持平滑边缘。
注意:如果在没有透明度的图像上使用,它将把所有颜色替换为单一颜色。

Parameters:

参数TypeDescription
new_color_argbint用于替换非透明颜色的新颜色 ARGB 值。

Method: resize(new_width, new_height)

 resize(new_width, new_height) 

调整图像大小。使用默认的 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。

Method: resize(new_width, new_height, resize_type)

 resize(new_width, new_height, resize_type) 

对图像执行等比例缩放操作,保持宽高比
同时调整尺寸。使用此方法在您的应用程序中动态缩放图像,
确保内容完整性的视觉表现一致。
等比例缩放将根据 newWidth/width 和 newHeight/height 的比例对每帧进行调整。

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。
resize_typeResizeType调整大小类型。

Method: resize(new_width, new_height, settings)

 resize(new_width, new_height, settings) 

根据指定设置调整图像大小,允许对尺寸、宽高比和缩放行为进行精确
控制。将此方法集成到您的图像处理工作流中,以实现针对应用程序特定需求的自定义缩放操作。

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。
settingsImageResizeSettings调整大小设置。

Method: resize_by_settings(new_width, new_height, settings)

 resize_by_settings(new_width, new_height, settings) 

调整图像大小。

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。
settingsImageResizeSettings调整大小设置。

Method: resize_by_type(new_width, new_height, resize_type)

 resize_by_type(new_width, new_height, resize_type) 

调整图像大小。

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。
resize_typeResizeType调整大小类型。

Method: resize_height_proportionally(new_height)

 resize_height_proportionally(new_height) 

按比例调整高度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE

Parameters:

参数TypeDescription
new_heightint新的高度。

Method: resize_height_proportionally(new_height, resize_type)

 resize_height_proportionally(new_height, resize_type) 

对图像高度进行等比例调整,保持宽高比
以确保视觉完整性一致。使用此方法在您的应用程序中动态缩放图像,
确保在各种平台和设备上实现最佳显示,而不影响内容质量。

Parameters:

参数TypeDescription
new_heightint新的高度。
resize_typeResizeType调整大小的类型。

Method: resize_height_proportionally(new_height, settings)

 resize_height_proportionally(new_height, settings) 

按比例调整高度。

Parameters:

参数TypeDescription
new_heightint新的高度。
settingsImageResizeSettings图像调整大小设置。

Method: resize_height_proportionally_settings(new_height, settings)

 resize_height_proportionally_settings(new_height, settings) 

按比例调整高度。

Parameters:

参数TypeDescription
new_heightint新的高度。
settingsImageResizeSettings图像调整大小设置。

Method: resize_proportional(new_width, new_height, resize_type)

 resize_proportional(new_width, new_height, resize_type) 

对图像执行等比例缩放操作,保持宽高比
同时调整尺寸。使用此方法在您的应用程序中动态缩放图像,
确保内容完整性的视觉表现一致。
等比例缩放将根据 newWidth/width 和 newHeight/height 的比例对每帧进行调整。

Parameters:

参数TypeDescription
new_widthint新的宽度。
new_heightint新的高度。
resize_typeResizeType调整大小类型。

Method: resize_width_proportionally(new_width)

 resize_width_proportionally(new_width) 

按比例调整宽度。默认使用 ResizeType.NEAREST_NEIGHBOUR_RESAMPLE

Parameters:

参数TypeDescription
new_widthint新的宽度。

Method: resize_width_proportionally(new_width, resize_type)

 resize_width_proportionally(new_width, resize_type) 

在保持宽高比的前提下调整图像宽度,确保
等比例缩放以获得最佳视觉呈现。利用此方法在您的应用程序中
动态缩放图像,促进在各种显示环境下的一致且
美观的渲染。

Parameters:

参数TypeDescription
new_widthint新的宽度。
resize_typeResizeType调整大小的类型。

Method: resize_width_proportionally(new_width, settings)

 resize_width_proportionally(new_width, settings) 

按比例调整宽度。

Parameters:

参数TypeDescription
new_widthint新的宽度。
settingsImageResizeSettings图像调整大小设置。

Method: resize_width_proportionally_settings(new_width, settings)

 resize_width_proportionally_settings(new_width, settings) 

按比例调整宽度。

Parameters:

参数TypeDescription
new_widthint新的宽度。
settingsImageResizeSettings图像调整大小设置。

Method: rotate(angle)

 rotate(angle) 

围绕中心旋转图像。

Parameters:

参数TypeDescription
角度float旋转角度(以度为单位)。正值将顺时针旋转。

Method: rotate(angle, resize_proportionally, background_color)

 rotate(angle, resize_proportionally, background_color) 

围绕图像中心点按指定角度旋转图像,实现精确
方向调整。将此功能纳入您的图像处理
管道,以实现准确的变换,确保视觉内容的最佳对齐和
呈现。

Parameters:

参数TypeDescription
角度float旋转角度(以度为单位)。正值将顺时针旋转。
resize_proportionallybool如果设置为 true,图像尺寸将根据旋转矩形(角点)投影进行更改;否则保持尺寸不变,仅旋转内部图像内容。
background_colorColor背景颜色。

Method: rotate_flip(rotate_flip_type)

 rotate_flip(rotate_flip_type) 

对活动帧执行旋转、翻转或两者的组合操作。此方法允许对图像序列中的单个帧进行精确操作,提升图像编辑和构图的灵活性。

Parameters:

参数TypeDescription
rotate_flip_typeRotateFlipType旋转翻转类型。

See also:

Example # 1: This example loads a TIFF image, rotates it by 90 degrees clockwise and optio…

Method: rotate_flip_all(rotate_flip)

 rotate_flip_all(rotate_flip) 

旋转并翻转全部。

Parameters:

参数TypeDescription
rotate_flipRotateFlipType旋转翻转。

Method: save(file_path)

 save(file_path) 

将图像保存到指定的文件位置。

Parameters:

参数TypeDescription
file_pathstring保存图像的文件路径。

Method: save(file_path, options)

 save(file_path, options) 

根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。

Parameters:

参数TypeDescription
file_pathstring文件路径。
optionsImageOptionsBase选项。

Method: save(file_path, options, bounds_rectangle)

 save(file_path, options, bounds_rectangle) 

根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。

Parameters:

参数TypeDescription
file_pathstring文件路径。
optionsImageOptionsBase选项。
bounds_rectangleRectangle目标图像边界矩形。将空矩形设置为使用源边界。

Method: save(file_path, over_write)

 save(file_path, over_write) 

将对象的数据保存到指定的文件位置。

Parameters:

参数TypeDescription
file_pathstring保存对象数据的文件路径。
over_writebool如果设置为 true,覆盖文件内容,否则将追加。

Method: save(stream)

 save(stream) 

将对象的数据保存到指定的流中。

Parameters:

参数TypeDescription
_io.BufferedRandom用于保存对象数据的流。

Method: save(stream, options_base)

 save(stream, options_base) 

根据保存选项,将图像的数据保存到指定流中的指定文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom保存图像数据的流。
options_baseImageOptionsBase保存选项。

Method: save(stream, options_base, bounds_rectangle)

 save(stream, options_base, bounds_rectangle) 

根据保存选项,将图像的数据保存到指定流中的指定文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom保存图像数据的流。
options_baseImageOptionsBase保存选项。
bounds_rectangleRectangle目标图像边界矩形。将空矩形设置为使用源边界。

Method: save_argb_32_pixels(rectangle, pixels)

 save_argb_32_pixels(rectangle, pixels) 

保存 32 位 ARGB 像素。

Parameters:

参数TypeDescription
rectangleRectangle保存像素的矩形。
像素int[]32 位 ARGB 像素数组。

Method: save_cmyk_32_pixels(rectangle, pixels)

 save_cmyk_32_pixels(rectangle, pixels) 

保存像素。

Parameters:

参数TypeDescription
rectangleRectangle保存像素的矩形。
像素int[]以 32 位整数值表示的 CMYK 像素。

Method: save_cmyk_pixels(rectangle, pixels)

 save_cmyk_pixels(rectangle, pixels) 

保存像素。
此方法已弃用。请使用更有效的 RasterImage.save_cmyk_32_pixels(rectangle, pixels) 方法。

Parameters:

参数TypeDescription
rectangleRectangle保存像素的矩形。
pixelsCmykColor[]CMYK 像素数组。

Method: save_pixels(rectangle, pixels)

 save_pixels(rectangle, pixels) 

保存像素的内部主要内容。

Parameters:

参数TypeDescription
rectangleRectangle矩形。
pixelsColor[]像素。

Method: save_raw_data(data, data_offset, rectangle, raw_data_settings)

 save_raw_data(data, data_offset, rectangle, raw_data_settings) 

保存原始数据。

Parameters:

参数TypeDescription
数据System.Byte原始数据。
data_offsetint起始原始数据偏移。
rectangleRectangle原始数据矩形。
raw_data_settingsRawDataSettings原始数据所在的设置。

Method: save_to_stream(stream)

 save_to_stream(stream) 

将图像保存到流中

Parameters:

参数TypeDescription
_io.BufferedRandom

Method: save_to_stream_with_options(stream, options_base)

 save_to_stream_with_options(stream, options_base) 

根据保存选项,将图像的数据保存到指定流中的指定文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom保存图像数据的流。
options_baseImageOptionsBase保存选项。

Method: save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)

 save_to_stream_with_options_rect(stream, options_base, bounds_rectangle) 

根据保存选项,将图像的数据保存到指定流中的指定文件格式。

Parameters:

参数TypeDescription
_io.BufferedRandom保存图像数据的流。
options_baseImageOptionsBase保存选项。
bounds_rectangleRectangle目标图像边界矩形。将空矩形设置为使用源边界。

Method: save_with_options(file_path, options)

 save_with_options(file_path, options) 

根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。

Parameters:

参数TypeDescription
file_pathstring文件路径。
optionsImageOptionsBase选项。

Method: save_with_options_rect(file_path, options, bounds_rectangle)

 save_with_options_rect(file_path, options, bounds_rectangle) 

根据保存选项,将对象的数据保存到指定文件位置的指定文件格式中。

Parameters:

参数TypeDescription
file_pathstring文件路径。
optionsImageOptionsBase选项。
bounds_rectangleRectangle目标图像边界矩形。将空矩形设置为使用源边界。

Method: set_argb_32_pixel(x, y, argb_32_color)

 set_argb_32_pixel(x, y, argb_32_color) 

为指定位置设置图像的 32 位 ARGB 像素。

Parameters:

参数TypeDescription
xint像素的 x 位置。
yint像素的 y 位置。
argb_32_colorint指定位置的 32 位 ARGB 像素。

Method: set_palette(palette, update_colors)

 set_palette(palette, update_colors) 

设置图像调色板。

Parameters:

参数TypeDescription
paletteIColorPalette要设置的调色板。
update_colorsbool如果设置为 true,颜色将根据新调色板进行更新;否则颜色索引保持不变。请注意,未更改的索引如果在加载时没有对应的调色板条目,可能会导致图像崩溃。

Method: set_pixel(x, y, color)

 set_pixel(x, y, color) 

为指定位置设置图像像素。

Parameters:

参数TypeDescription
xint像素的 x 位置。
yint像素的 y 位置。
colorColor指定位置的像素颜色。

Method: set_resolution(dpi_x, dpi_y)

 set_resolution(dpi_x, dpi_y) 

为指定的 RasterImage 建立分辨率,能够
精确控制图像渲染和显示属性。集成此
功能以优化视觉输出并确保与各种
输出设备和平台的兼容性,提升整体用户体验。

Parameters:

参数TypeDescription
dpi_xfloat以每英寸点数表示的 RasterImage 的水平分辨率。
dpi_yfloat以每英寸点数表示的 RasterImage 的垂直分辨率。

Method: try_set_metadata(metadata)

 try_set_metadata(metadata) 

尝试设置一个 metadata 实例,前提是此 Image 实例支持并实现 IImageMetadataFormat 实例。

Parameters:

参数TypeDescription
metadataIImageMetadataFormat元数据。

Returns

TypeDescription
bool如果 metadata 不为 null 且 IMetadataContainer 实例
支持和/或实现 IImageMetadataFormat 实例,则为 true;否则为 false。

Method: write_argb_32_scan_line(scan_line_index, argb_32_pixels)

 write_argb_32_scan_line(scan_line_index, argb_32_pixels) 

将整条扫描线写入指定的扫描线索引。

Parameters:

参数TypeDescription
scan_line_indexint扫描线的零基索引。
argb_32_pixelsint[]要写入的 32 位 ARGB 颜色数组。

Method: write_scan_line(scan_line_index, pixels)

 write_scan_line(scan_line_index, pixels) 

将整条扫描线写入指定的扫描线索引。

Parameters:

参数TypeDescription
scan_line_indexint扫描线的零基索引。
pixelsColor[]要写入的像素颜色数组。

Examples

This example loads a TIFF image, rotates it by 90 degrees clockwise and optionally flips the image horizontally and(or) vertically.


from os.path import join
import aspose.pycore as aspycore
from aspose.imaging import Image, RotateFlipType
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions

dir_: str = "c:\\temp"
rotate_flip_types = [RotateFlipType.ROTATE_90_FLIP_NONE, RotateFlipType.ROTATE_90_FLIP_X, RotateFlipType.ROTATE_90_FLIP_XY, RotateFlipType.ROTATE_90_FLIP_Y]
for rotate_flip_type in rotate_flip_types:
	# 旋转、翻转并保存到输出文件。
	with aspycore.as_of(Image.load(join(dir_, "sample.tif")), TiffImage) as image:
		image.rotate_flip(rotate_flip_type)
		image.save(join(dir_, "sample." + rotate_flip_type + ".png"), PngOptions())

The following example loads a TIFF image and prints information about raw data format and alpha channel.


import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from os.path import join as path_join


dir_ = "c:\\temp"
file_name = path_join(dir_, "sample.tif")
with Image.load(file_name) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 如果活动的 TIFF 帧具有 alpha 通道,则整个 TIFF 图像被视为具有 alpha 通道。
	print("ImageFile={0}, FileFormat={1}, HasAlpha={2}".format(file_name, tiff_image.raw_data_format, tiff_image.has_alpha))
	i = 1
	for frame in tiff_image.frames:
		print("Frame={0}, FileFormat={1}, HasAlpha={2}".format(i, frame.raw_data_format, frame.has_alpha))
		i += 1

# 输出可能如下所示:
# ImageFile=c:\temp\sample.tif, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
# Frame=1, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
# Frame=2, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False

The following example crops a TIFF image. The cropping area is be specified via aspose.imaging.Rectangle.

import aspose.pycore as aspycore
from aspose.imaging import Image, Rectangle
from aspose.imaging.imageoptions import PngOptions
from aspose.imaging.fileformats.tiff import TiffImage
from os.path import join

dir_: str = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 裁剪图像。裁剪区域是图像的矩形中心区域。
	area = Rectangle(tiff_image.width // 4, tiff_image.height // 4, tiff_image.width // 2,
					 tiff_image.height // 2)
	tiff_image.crop(area)
	# 将裁剪后的图像保存为 PNG。
	tiff_image.save(join(dir_, "sample.Crop.png"), PngOptions())

The following example crops a TIFF image. The cropping area is specified via Left, Top, Right, Bottom margins.

from os.path import join
import aspose.pycore as aspycore
from aspose.imaging import Image       
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions

dir_: str = r"c:\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 再次裁剪。设置图像大小的10%边距。
	horizontal_margin: int = tiff_image.width // 10
	vertical_margin: int = tiff_image.height // 10
	tiff_image.crop(horizontal_margin, horizontal_margin, vertical_margin, vertical_margin)
	# 将裁剪后的图像保存为 PNG。
	tiff_image.save(join(dir_, "sample.Crop.png"), PngOptions())

The following example binarizes a TIFF image with the predefined threshold. Binarized images contain only 2 colors - black and white.


import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions
from os.path import join

dir_ = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 使用阈值127对图像进行二值化。
	# 如果像素的对应灰度值大于127,则赋值为255,否则为0。
	tiff_image.binarize_fixed(127)
	tiff_image.save(join(dir_, "sample.BinarizeFixed.png"), PngOptions())

The following example binarizes a TIFF image with Bradley’s adaptive thresholding algorithm with the specified window size. Binarized images contain only 2 colors - black and white.

from os.path import join
import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions

dir_: str = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 使用亮度差5对图像进行二值化。亮度是指像素与以该像素为中心的10×10窗口像素平均值之间的差异。
	tiff_image.binarize_bradley(5, 10)
	tiff_image.save(join(dir_, "sample.BinarizeBradley5_10x10.png"), PngOptions())

The following example performs gamma-correction of a TIFF image.

import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions
from os.path import join

dir_: str = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 设置红、绿、蓝通道的伽马系数。
	tiff_image.adjust_gamma(2.5)
	tiff_image.save(join(dir_, "sample.AdjustGamma.png"), PngOptions())

The following example performs gamma-correction of a TIFF image applying different coefficients for color components.


import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions
from os.path import join

dir_ = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 为红、绿、蓝通道分别设置伽马系数。
	tiff_image.adjust_gamma(1.5, 2.5, 3.5)
	tiff_image.save(join(dir_, "sample.AdjustGamma.png"), PngOptions())

The following example performs brightness correction of a TIFF image.


import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions
from os.path import join

dir_ = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 设置亮度值。亮度的可接受范围为 [-255, 255]。
	tiff_image.adjust_brightness(50)
	tiff_image.save(join(dir_, "sample.AdjustBrightness.png"), PngOptions())

The following example performs contrast correction of a TIFF image.


import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.imageoptions import PngOptions
from os.path import join

dir_ = "c:\\temp"
with Image.load(join(dir_, "sample.tif")) as image:
	tiff_image = aspycore.as_of(image, TiffImage)
	# 设置对比度值。对比度的可接受范围为 [-100f, 100f]。
	tiff_image.adjust_contrast(50.0)
	tiff_image.save(join(dir_, "sample.AdjustContrast.png"), PngOptions())

Create Graphics Path from Path Resources in TIFF image.


import aspose.pycore as aspycore
from aspose.imaging import Image, Graphics, Color, Pen
from aspose.imaging.fileformats.tiff import TiffImage
from aspose.imaging.fileformats.tiff.pathresources import PathResourceConverter

with aspycore.as_of(Image.load("Bottle.tif"), TiffImage) as image:
	# 使用来自 TIFF 图像的 PathResources 创建 GraphicsPath
	active_frame = image.active_frame
	graphics_path = PathResourceConverter.to_graphics_path(active_frame.path_resource, active_frame.size)
	graphics = Graphics(image)
	# 绘制红色线条并保存图像
	graphics.draw_path(Pen(Color.red, 10), graphics_path)
	image.save("BottleWithRedBorder.tif")