TiffImage Class

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, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IMultipageImage, IMultipageImageExt, IHasExifData, RasterCachedMultipageImage

Constructors

NameDescription
TiffImage(frame)Initialize a new object of the TiffImage class, specifying the
frame parameter. This constructor facilitates the creation of a TiffImage
instance, allowing developers to specify the frame to be loaded or processed,
streamlining Tiff image handling tasks within their applications.
TiffImage(frames)Create a new instance of the TiffImage class, providing a list of
frames as a parameter. This constructor enables the initialization of a TiffImage
object with multiple frames, facilitating efficient handling and processing of
TIFF image sequences within software applications.

Properties

NameTypeAccessDescription
active_frameTiffFramer/wManage the active frame seamlessly, facilitating dynamic navigation and
manipulation within the designated context. Empower your application to interact
efficiently with multimedia content, enhancing user engagement and productivity.
auto_adjust_paletteboolr/wGets or sets a value indicating whether automatic adjust palette.
background_colorColorr/wGets or sets a value for the background color.
bits_per_pixelintrGets the image bits per pixel count.
boundsRectanglerGets the object bounds.
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
byte_orderTiffByteOrderr/wToggle the byte order for TIFF files seamlessly, ensuring precise control over
data interpretation. Empower your applications with the flexibility to adapt to
diverse file specifications, enhancing compatibility and efficiency in data processing.
containerImagerGets the Image container.
data_stream_containerStreamContainerrGets the object’s data stream.
disposedboolrGets a value indicating whether this instance is disposed.
exif_dataExifDatar/wAccess or modify EXIF data associated with the active frame seamlessly, empowering
precise control over image metadata. Enhance your application’s capabilities by
integrating this feature, ensuring accurate preservation and customization of
essential image information.
file_formatFileFormatrRetrieve the file format value associated with the image. This property serves as
a critical aspect of image metadata retrieval, allowing software applications to
identify and interpret the format of the image data efficiently.
framesTiffFrame[]rRetrieve an array of TiffFrame instances, enabling comprehensive
access and manipulation of individual frames within the TIFF image. Harness the
power of this array to streamline image processing workflows, ensuring precise
control and optimization of visual content.
has_alphaboolrDetermine whether the image has an alpha channel, providing crucial information
for rendering and compositing operations. Integrate this feature to optimize
visual processing workflows, ensuring accurate representation and manipulation of
transparent elements.
has_background_colorboolr/wGets or sets a value indicating whether image has background color.
has_transparent_colorboolr/wGets a value indicating whether image has transparent color.
heightintrGets the image height.
horizontal_resolutiondoubler/wRetrieve the horizontal resolution of the specified Image in pixels
per inch, facilitating precise adjustment and rendering capabilities. Access
essential image metadata effortlessly, empowering streamlined image processing
workflows for enhanced user experiences.
image_opacityfloatrGets opacity of this image.
interrupt_monitorInterruptMonitorr/wGets or sets the interrupt monitor.
is_cachedboolrGets a value indicating whether image data is cached currently.
is_raw_data_availableboolrGets a value indicating whether raw data loading is supported.
page_countintrRetrieve the total count of pages within the specified document, facilitating
efficient navigation and management of multi-page content. Incorporate this
functionality to enhance user experience, enabling seamless access to
comprehensive document structures.
pagesImage[]rAccess the pages of the document seamlessly, enabling dynamic navigation and
manipulation within the content structure. Empower your application with efficient
access to individual pages, facilitating streamlined document processing and
enhanced user interaction.
paletteIColorPaletter/wGets or sets the color palette. The color palette is not used when pixels are represented directly.
premultiply_componentsboolr/wIndicate if components necessitate premultiplication, ensuring efficient handling
of visual elements. Enhance rendering processes by toggling this property,
streamlining graphic workflows for optimized performance.
raw_custom_color_converterIColorConverterr/wGets or sets the custom color converter
raw_data_formatPixelDataFormatrGets the raw data format.
raw_data_settingsRawDataSettingsrGets the current raw data settings. Note when using these settings the data loads without conversion.
raw_fallback_indexintr/wGets or sets the fallback index to use when palette index is out of bounds
raw_indexed_color_converterIIndexedColorConverterr/wGets or sets the indexed color converter
raw_line_sizeintrGets the raw line size in bytes.
sizeSizerGets the object size.
transparent_colorColorr/wGets the image transparent color.
update_xmp_databoolr/wGets or sets a value indicating whether to update the XMP metadata.
use_paletteboolrGets a value indicating whether the image palette is used.
use_raw_databoolr/wGets or sets a value indicating whether to use raw data loading when the raw data loading is available.
vertical_resolutiondoubler/wAccess the vertical resolution of the designated Image in pixels per
inch, enabling precise adjustments and rendering optimizations. Utilize essential
image data effortlessly to streamline image processing workflows, ensuring
superior quality and performance in your applications.
widthintrGets the image width.
xmp_dataXmpPacketWrapperr/wGets or sets XMP data from frame.

Methods

NameDescription
add(image)Add the frames from the specified image seamlessly into the current frame,
consolidating their content and enhancing compositional flexibility. Integrate
this method to streamline frame management and manipulation within your
application, facilitating efficient handling of multi-frame images.
add_frame(frame)Incorporate the specified frame seamlessly into the image, expanding its content
and versatility. Utilize this method to enhance image composition and management,
empowering efficient handling of multi-frame images within your application.
add_frames(frames)Integrate the array of frames seamlessly into the image, enriching its content and
versatility. Utilize this method to enhance image composition and management,
enabling efficient handling of multi-frame images within your application.
add_page(page)Incorporate a new page into the existing image seamlessly, expanding its content
and versatility. Utilize this method to enhance document composition and
management, empowering efficient handling of multi-page images within your application.
adjust_brightness(brightness)Implement brightness adjustment for the image, allowing the
modification of overall luminance levels. Incorporate this method into your image
processing workflow to enhance visibility and improve the visual quality of
images within your application.
adjust_contrast(contrast)Enhance the contrast of the Image instance,
amplifying the differences between its light and dark areas. Integrate this
functionality to improve the visual clarity and overall quality of the image
within your application.
adjust_gamma(gamma)Apply gamma correction to the image, adjusting pixel intensities to achieve
desired color balance. Incorporate this method into your image processing
workflow to enhance visual quality and improve the accuracy of subsequent
analysis or display tasks within your application.
adjust_gamma(gamma_red, gamma_green, gamma_blue)Perform gamma correction on the image using individual coefficients for red,
green, and blue channels, allowing for fine-tuned adjustments of color balance
and contrast. Integrate this method into your image processing pipeline to
achieve precise control over color rendering and enhance visual fidelity within
your application.
align_resolutions()Implement the AlignResolutions helper method to synchronize horizontal and
vertical resolutions, ensuring uniformity in image dimensions. This functionality
facilitates streamlined image processing workflows by harmonizing resolution
parameters, optimizing visual quality and consistency across various platforms and
devices.
binarize_bradley(brightness_difference)Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding
binarize_bradley(brightness_difference, window_size)Implement binarization on the image employing Bradley’s adaptive thresholding
algorithm with integral image thresholding. This approach dynamically computes
local thresholds based on the image’s neighborhood, enhancing adaptability to
varying lighting conditions and ensuring robust segmentation for subsequent
processing tasks within your application.
binarize_fixed(threshold)Apply binarization to the image using a predefined threshold, converting it into
a binary image with distinct foreground and background regions. Incorporate this
method into your image processing workflow to facilitate segmentation and feature
extraction tasks, enhancing the accuracy and efficiency of image analysis within
your application.
binarize_otsu()Utilize Otsu thresholding to perform binarization on the image, automatically
determining the optimal threshold value based on the image’s histogram. Integrate
this method into your image processing workflow to achieve effective segmentation
and feature extraction, enhancing the accuracy and reliability of image analysis
tasks within your application.
blend(origin, overlay, overlay_alpha)Blends this image instance with the overlay image.
blend(origin, overlay, overlay_area, overlay_alpha)Blends this image instance with the overlay image.
cache_data()Caches the data private.
can_load(file_path)Determines whether image can be loaded from the specified file path.
can_load(file_path, load_options)Determines whether image can be loaded from the specified file path and optionally using the specified open options.
can_load(stream)Determines whether image can be loaded from the specified stream.
can_load(stream, load_options)Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.
can_load_stream(stream)Determines whether image can be loaded from the specified stream.
can_load_stream_with_options(stream, load_options)Determines whether image can be loaded from the specified stream and optionally using the specified loadOptions.
can_load_with_options(file_path, load_options)Determines whether image can be loaded from the specified file path and optionally using the specified open options.
can_save(options)Determines whether image can be saved to the specified file format represented by the passed save options.
create(files)Creates the specified files.
create(files, throw_exception_on_load_error)Creates the specified files.
create(image_options, width, height)Creates a new image using the specified create options.
create(images)Creates a new image using the specified images as pages
create(images, dispose_images)Creates a new image the specified images as pages.
create(multipage_create_options)Creates the specified multipage create options.
create_with_frame(frame)Initializes a new instance of the TiffImage class.
create_with_frames(frames)Initializes a new instance of the TiffImage class.
crop(left_shift, right_shift, top_shift, bottom_shift)Perform cropping on the image by specifying shifts in the left, right, top, and
bottom directions. This method enables precise selection of the desired portion of
the image, facilitating efficient removal of unwanted areas and focusing on
essential content. Integrate this functionality into your image processing
pipeline to enhance clarity and composition as needed within your application.
crop(rectangle)Crop the image using a specified rectangular region, allowing precise selection of
desired content. Integrate this method into your image processing workflow to
efficiently remove unwanted areas and focus on essential details, enhancing the
overall clarity and composition of the image.
dither(dithering_method, bits_count)Performs dithering on the current image.
dither(dithering_method, bits_count, custom_palette)Execute dithering on the current image to enhance its visual quality and reduce
color banding artifacts. Integrate this method into your image processing workflow
to ensure smoother transitions between colors, resulting in improved overall image
appearance and clarity.
filter(rectangle, options)Filter the content within the specified rectangle, applying a designated image
processing filter to enhance or modify the selected region. Integrate this method
into your image manipulation workflow to achieve targeted enhancements or
transformations within your application.
get_argb_32_pixel(x, y)Gets an image 32-bit ARGB pixel.
get_default_argb_32_pixels(rectangle)Gets the default 32-bit ARGB pixels array.
get_default_options(args)Gets the default options.
get_default_pixels(rectangle, partial_pixel_loader)Gets the default pixels array using partial pixel loader.
get_default_raw_data(rectangle, partial_raw_data_loader, raw_data_settings)Gets the default raw data array using partial pixel loader.
get_default_raw_data(rectangle, raw_data_settings)Gets the default raw data array.
get_file_format(file_path)Gets the file format.
get_file_format(stream)Gets the file format.
get_file_format_of_stream(stream)Gets the file format.
get_fitting_rectangle(rectangle, pixels, width, height)Gets rectangle which fits the current image.
get_fitting_rectangle(rectangle, width, height)Gets rectangle which fits the current image.
get_modify_date(use_default)Gets the date and time the resource image was last modified.
get_original_options()Retrieve options derived from the original file settings, facilitating seamless
preservation of key parameters such as bit-depth and other essential attributes of
the original image. Utilize this method to maintain fidelity and consistency in
image processing tasks, ensuring optimal results without unnecessary alterations.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
DataStreamSupporter.save(file_path) method, the output PNG image with 8-bit per pixel will be produced.
To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them
to the Image.save(file_path, options) method as the second parameter.
get_pixel(x, y)Gets an image pixel.
get_proportional_height(width, height, new_width)Gets a proportional height.
get_proportional_width(width, height, new_height)Gets a proportional width.
get_serialized_stream(image_options, clipping_rectangle, page_number)Converts to aps.
get_skew_angle()Gets the skew angle.
This method is applicable to scanned text documents, to determine the skew angle when scanning.
grayscale()Convert the image to its grayscale representation, transforming it into a
single-channel image where each pixel represents intensity. Integrate this method
into your image processing pipeline to simplify analysis and enhance
compatibility with grayscale-based algorithms, facilitating various computer
vision and image analysis tasks within your application.
insert_frame(index, frame_to_insert)Insert the new frame at the specified index within the frame sequence, ensuring
precise control over frame arrangement. Employ this method to manage frame
sequences effectively, facilitating dynamic manipulation and organization of image
content within your application.
load(file_path)Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.
load(file_path, load_options)Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.
load(stream)Loads a new image from the specified stream.
load(stream, load_options)Loads a new image from the specified stream.
load_argb_32_pixels(rectangle)Loads 32-bit ARGB pixels.
load_argb_64_pixels(rectangle)Loads 64-bit ARGB pixels.
load_cmyk_32_pixels(rectangle)Loads pixels in CMYK format.
load_cmyk_pixels(rectangle)Loads pixels in CMYK format.
This method is deprecated. Please use more effective the RasterImage.load_cmyk_32_pixels(rectangle) method.
load_partial_argb_32_pixels(rectangle, partial_pixel_loader)Loads 32-bit ARGB pixels partially (by blocks).
load_partial_argb_64_pixels(rectangle, partial_pixel_loader)Loads 64-bit ARGB pixels partially by packs.
load_partial_pixels(desired_rectangle, pixel_loader)Loads pixels partially by packs.
load_pixels(rectangle)Loads pixels.
load_raw_data(rectangle, dest_image_bounds, raw_data_settings, raw_data_loader)Loads raw data.
load_raw_data(rectangle, raw_data_settings, raw_data_loader)Loads raw data.
load_stream(stream)Loads a new image from the specified stream.
load_stream_with_options(stream, load_options)Loads a new image from the specified stream.
load_with_options(file_path, load_options)Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.
normalize_angle()Normalizes the angle.
This method is applicable to scanned text documents to get rid of the skewed scan.
This method uses RasterImage.get_skew_angle() and RasterImage.rotate(angle) methods.
normalize_angle(resize_proportionally, background_color)Utilize the NormalizeAngle method specifically designed for scanned text documents
to rectify skewed scans, ensuring accurate alignment. Seamlessly
integrate this functionality into your text processing workflows to enhance
document readability and quality, improving overall efficiency in text recognition
and analysis tasks.
This method uses RasterImage.get_skew_angle() and TiffImage.rotate(angle, resize_proportionally, background_color) methods.
read_argb_32_scan_line(scan_line_index)Reads the whole scan line by the specified scan line index.
read_scan_line(scan_line_index)Reads the whole scan line by the specified scan line index.
remove_frame(frame)Efficiently remove the specified frame from the image sequence, facilitating
streamlined frame management within your application. Integrate this functionality
to enhance precision and flexibility in frame manipulation, ensuring seamless
organization and presentation of image content.
remove_frame(index)Removes the frame by its index.
remove_frame_by_index(index)Removes the frame by its index.
remove_metadata()Removes this image instance metadata by setting this IHasXmpData.xmp_data and IHasExifData.exif_data values to None.
replace_argb(old_color_argb, old_color_diff, new_color_argb)Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
replace_color(old_color, old_color_diff, new_color)Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
replace_color(old_color_argb, old_color_diff, new_color_argb)Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
replace_frame(index, frame_to_replace)Substitute the frame at the designated position with another frame seamlessly,
facilitating dynamic frame management within the image sequence. Integrate this
method to enhance flexibility and precision in frame manipulation, ensuring
optimal organization and presentation of image content within your application.
replace_non_transparent_colors(new_color)Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
Note: if you use it on images without transparency, all colors will be replaced with a single one.
replace_non_transparent_colors(new_color_argb)Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
Note: if you use it on images without transparency, all colors will be replaced with a single one.
resize(new_width, new_height)Resizes the image. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize(new_width, new_height, resize_type)Conduct a proportional resize operation on the image, preserving its aspect ratio
while adjusting its dimensions. Employ this method to dynamically scale images
within your application, ensuring consistent visual representation of content
integrity.
The proportional resize will resize each frame according to the ratio of newWidth/width and newHeight/height.
resize(new_width, new_height, settings)Resizes the image.
resize_by_settings(new_width, new_height, settings)Resizes the image.
resize_by_type(new_width, new_height, resize_type)Resizes the image.
resize_height_proportionally(new_height)Resizes the height proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize_height_proportionally(new_height, resize_type)Conduct a proportional adjustment of the image’s height, preserving its aspect
ratio for consistent visual integrity. Employ this method to dynamically resize
images within your application, ensuring optimal display across diverse platforms
and devices without compromising content quality.
resize_height_proportionally(new_height, settings)Resizes the height proportionally.
resize_height_proportionally_settings(new_height, settings)Resizes the height proportionally.
resize_proportional(new_width, new_height, resize_type)Conduct a proportional resize operation on the image, preserving its aspect ratio
while adjusting its dimensions. Employ this method to dynamically scale images
within your application, ensuring consistent visual representation of content
integrity.
The proportional resize will resize each frame according to the ratio of newWidth/width and newHeight/height.
resize_width_proportionally(new_width)Resizes the width proportionally. The default ResizeType.NEAREST_NEIGHBOUR_RESAMPLE is used.
resize_width_proportionally(new_width, resize_type)Adjust the width of the image while maintaining its aspect ratio, ensuring
proportional resizing for optimal visual presentation. Utilize this method to
dynamically scale images within your application, facilitating consistent and
aesthetically pleasing rendering across various display contexts.
resize_width_proportionally(new_width, settings)Resizes the width proportionally.
resize_width_proportionally_settings(new_width, settings)Resizes the width proportionally.
rotate(angle)Rotate image around the center.
rotate(angle, resize_proportionally, background_color)Rotate the image around its center point by a specified angle, enabling precise
orientation adjustments. Incorporate this functionality into your image processing
pipeline to facilitate accurate transformations, ensuring optimal alignment and
presentation of visual content within your application.
rotate_flip(rotate_flip_type)Perform rotation, flipping, or a combination of both operations exclusively on the
active frame. This method allows precise manipulation of individual frames within
the image sequence, enhancing flexibility in image editing and composition within
your application.
rotate_flip_all(rotate_flip)Rotates the flip all.
save()Saves the image data to the underlying stream.
save(file_path)Saves the image to the specified file location.
save(file_path, options)Saves the object’s data to the specified file location in the specified file format according to save options.
save(file_path, options, bounds_rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
save(file_path, over_write)Saves the object’s data to the specified file location.
save(stream)Saves the object’s data to the specified stream.
save(stream, options_base)Saves the image’s data to the specified stream in the specified file format according to save options.
save(stream, options_base, bounds_rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
save_argb_32_pixels(rectangle, pixels)Saves the 32-bit ARGB pixels.
save_cmyk_32_pixels(rectangle, pixels)Saves the pixels.
save_cmyk_pixels(rectangle, pixels)Saves the pixels.
This method is deprecated. Please use more effective the RasterImage.save_cmyk_32_pixels(rectangle, pixels) method.
save_pixels(rectangle, pixels)Saves the pixels internal main.
save_raw_data(data, data_offset, rectangle, raw_data_settings)Saves the raw data.
save_to_stream(stream)Saves image to stream
save_to_stream_with_options(stream, options_base)Saves the image’s data to the specified stream in the specified file format according to save options.
save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
save_with_options(file_path, options)Saves the object’s data to the specified file location in the specified file format according to save options.
save_with_options_rect(file_path, options, bounds_rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
set_argb_32_pixel(x, y, argb_32_color)Sets an image 32-bit ARGB pixel for the specified position.
set_palette(palette, update_colors)Sets the image palette.
set_pixel(x, y, color)Sets an image pixel for the specified position.
set_resolution(dpi_x, dpi_y)Establishes the resolution for the specified RasterImage, enabling
precise control over image rendering and display properties. Integrate this
functionality to optimize visual output and ensure compatibility with diverse
output devices and platforms, enhancing the overall user experience.
write_argb_32_scan_line(scan_line_index, argb_32_pixels)Writes the whole scan line to the specified scan line index.
write_scan_line(scan_line_index, pixels)Writes the whole scan line to the specified scan line index.

Constructor: TiffImage(frame)

 TiffImage(frame) 

Initialize a new object of the TiffImage class, specifying the
frame parameter. This constructor facilitates the creation of a TiffImage
instance, allowing developers to specify the frame to be loaded or processed,
streamlining Tiff image handling tasks within their applications.

Parameters:

ParameterTypeDescription
frameTiffFrameThe tiff frame to initialize image with.

Constructor: TiffImage(frames)

 TiffImage(frames) 

Create a new instance of the TiffImage class, providing a list of
frames as a parameter. This constructor enables the initialization of a TiffImage
object with multiple frames, facilitating efficient handling and processing of
TIFF image sequences within software applications.

Parameters:

ParameterTypeDescription
framesTiffFrame[]The frames.

Method: add(image)

 add(image) 

Add the frames from the specified image seamlessly into the current frame,
consolidating their content and enhancing compositional flexibility. Integrate
this method to streamline frame management and manipulation within your
application, facilitating efficient handling of multi-frame images.

Parameters:

ParameterTypeDescription
imageTiffImageThe source image.

Method: add_frame(frame)

 add_frame(frame) 

Incorporate the specified frame seamlessly into the image, expanding its content
and versatility. Utilize this method to enhance image composition and management,
empowering efficient handling of multi-frame images within your application.

Parameters:

ParameterTypeDescription
frameTiffFrameThe frame to add.

Method: add_frames(frames)

 add_frames(frames) 

Integrate the array of frames seamlessly into the image, enriching its content and
versatility. Utilize this method to enhance image composition and management,
enabling efficient handling of multi-frame images within your application.

Parameters:

ParameterTypeDescription
framesTiffFrame[]The frames array to add

Method: add_page(page)

 add_page(page) 

Incorporate a new page into the existing image seamlessly, expanding its content
and versatility. Utilize this method to enhance document composition and
management, empowering efficient handling of multi-page images within your application.

Parameters:

ParameterTypeDescription
pageRasterImageThe page to add.

Method: adjust_brightness(brightness)

 adjust_brightness(brightness) 

Implement brightness adjustment for the image, allowing the
modification of overall luminance levels. Incorporate this method into your image
processing workflow to enhance visibility and improve the visual quality of
images within your application.

Parameters:

ParameterTypeDescription
brightnessintBrightness value.

See also:

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

Method: adjust_contrast(contrast)

 adjust_contrast(contrast) 

Enhance the contrast of the Image instance,
amplifying the differences between its light and dark areas. Integrate this
functionality to improve the visual clarity and overall quality of the image
within your application.

Parameters:

ParameterTypeDescription
contrastfloatContrast value (in range [-100; 100])

See also:

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

Method: adjust_gamma(gamma)

 adjust_gamma(gamma) 

Apply gamma correction to the image, adjusting pixel intensities to achieve
desired color balance. Incorporate this method into your image processing
workflow to enhance visual quality and improve the accuracy of subsequent
analysis or display tasks within your application.

Parameters:

ParameterTypeDescription
gammafloatGamma for red, green and blue channels coefficient

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) 

Perform gamma correction on the image using individual coefficients for red,
green, and blue channels, allowing for fine-tuned adjustments of color balance
and contrast. Integrate this method into your image processing pipeline to
achieve precise control over color rendering and enhance visual fidelity within
your application.

Parameters:

ParameterTypeDescription
gamma_redfloatGamma for red channel coefficient
gamma_greenfloatGamma for green channel coefficient
gamma_bluefloatGamma for blue channel coefficient

See also:

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

Method: binarize_bradley(brightness_difference)

 binarize_bradley(brightness_difference) 

Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding

Parameters:

ParameterTypeDescription
brightness_differencedoubleThe brightness difference between pixel and the average of an s x s window of pixels
centered around this pixel.

Method: binarize_bradley(brightness_difference, window_size)

 binarize_bradley(brightness_difference, window_size) 

Implement binarization on the image employing Bradley’s adaptive thresholding
algorithm with integral image thresholding. This approach dynamically computes
local thresholds based on the image’s neighborhood, enhancing adaptability to
varying lighting conditions and ensuring robust segmentation for subsequent
processing tasks within your application.

Parameters:

ParameterTypeDescription
brightness_differencedoubleThe brightness difference between pixel and the average of an s x s window of pixels
centered around this pixel.
window_sizeintThe size of s x s window of pixels centered around this pixel

Method: binarize_fixed(threshold)

 binarize_fixed(threshold) 

Apply binarization to the image using a predefined threshold, converting it into
a binary image with distinct foreground and background regions. Incorporate this
method into your image processing workflow to facilitate segmentation and feature
extraction tasks, enhancing the accuracy and efficiency of image analysis within
your application.

Parameters:

ParameterTypeDescription
thresholdbyteThreshold value. If corresponding gray value of a pixel is greater than threshold, a value of
255 will be assigned to it, 0 otherwise.

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) 

Blends this image instance with the overlay image.

Parameters:

ParameterTypeDescription
originPointThe background image blending origin.
overlayRasterImageThe overlay image.
overlay_alphabyteThe overlay alpha.

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

 blend(origin, overlay, overlay_area, overlay_alpha) 

Blends this image instance with the overlay image.

Parameters:

ParameterTypeDescription
originPointThe background image blending origin.
overlayRasterImageThe overlay image.
overlay_areaRectangleThe overlay area.
overlay_alphabyteThe overlay alpha.

Method: can_load(file_path) [static]

 can_load(file_path) 

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

Parameters:

ParameterTypeDescription
file_pathstringThe file path.

Returns

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

Method: can_load(file_path, load_options) [static]

 can_load(file_path, load_options) 

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

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
load_optionsLoadOptionsThe load options.

Returns

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

Method: can_load(stream) [static]

 can_load(stream) 

Determines whether image can be loaded from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.

Returns

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

Method: can_load(stream, load_options) [static]

 can_load(stream, load_options) 

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

Parameters:

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

Returns

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

Method: can_load_stream(stream) [static]

 can_load_stream(stream) 

Determines whether image can be loaded from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load from.

Returns

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

Method: can_load_stream_with_options(stream, load_options) [static]

 can_load_stream_with_options(stream, load_options) 

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

Parameters:

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

Returns

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

Method: can_load_with_options(file_path, load_options) [static]

 can_load_with_options(file_path, load_options) 

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

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
load_optionsLoadOptionsThe load options.

Returns

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

Method: can_save(options)

 can_save(options) 

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

Parameters:

ParameterTypeDescription
optionsImageOptionsBaseThe save options to use.

Returns

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

Method: create(files) [static]

 create(files) 

Creates the specified files.

Parameters:

ParameterTypeDescription
filesstringThe files.

Returns

TypeDescription
ImageThe multipage image

Method: create(files, throw_exception_on_load_error) [static]

 create(files, throw_exception_on_load_error) 

Creates the specified files.

Parameters:

ParameterTypeDescription
filesstringThe files.
throw_exception_on_load_errorboolif set to true [throw exception on load error].

Returns

TypeDescription
ImageThe multipage image

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

 create(image_options, width, height) 

Creates a new image using the specified create options.

Parameters:

ParameterTypeDescription
image_optionsImageOptionsBaseThe image options.
widthintThe width.
heightintThe height.

Returns

TypeDescription
ImageThe newly created image.

Method: create(images) [static]

 create(images) 

Creates a new image using the specified images as pages

Parameters:

ParameterTypeDescription
imagesImage[]The images.

Returns

TypeDescription
ImageThe Image as IMultipageImage

Method: create(images, dispose_images) [static]

 create(images, dispose_images) 

Creates a new image the specified images as pages.

Parameters:

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

Returns

TypeDescription
ImageThe Image as IMultipageImage

Method: create(multipage_create_options) [static]

 create(multipage_create_options) 

Creates the specified multipage create options.

Parameters:

ParameterTypeDescription
multipage_create_optionsMultipageCreateOptionsThe multipage create options.

Returns

TypeDescription
ImageThe multipage image

Method: create_with_frame(frame) [static]

 create_with_frame(frame) 

Initializes a new instance of the TiffImage class.

Parameters:

ParameterTypeDescription
frameTiffFrameThe tiff frame to initialize image with.

Returns

TypeDescription
TiffImage

Method: create_with_frames(frames) [static]

 create_with_frames(frames) 

Initializes a new instance of the TiffImage class.

Parameters:

ParameterTypeDescription
framesTiffFrame[]The frames.

Returns

TypeDescription
TiffImage

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

 crop(left_shift, right_shift, top_shift, bottom_shift) 

Perform cropping on the image by specifying shifts in the left, right, top, and
bottom directions. This method enables precise selection of the desired portion of
the image, facilitating efficient removal of unwanted areas and focusing on
essential content. Integrate this functionality into your image processing
pipeline to enhance clarity and composition as needed within your application.

Parameters:

ParameterTypeDescription
left_shiftintThe left shift.
right_shiftintThe right shift.
top_shiftintThe top shift.
bottom_shiftintThe bottom shift.

Method: crop(rectangle)

 crop(rectangle) 

Crop the image using a specified rectangular region, allowing precise selection of
desired content. Integrate this method into your image processing workflow to
efficiently remove unwanted areas and focus on essential details, enhancing the
overall clarity and composition of the image.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle.

Method: dither(dithering_method, bits_count)

 dither(dithering_method, bits_count) 

Performs dithering on the current image.

Parameters:

ParameterTypeDescription
dithering_methodDitheringMethodThe dithering method.
bits_countintThe final bits count for dithering.

Method: dither(dithering_method, bits_count, custom_palette)

 dither(dithering_method, bits_count, custom_palette) 

Execute dithering on the current image to enhance its visual quality and reduce
color banding artifacts. Integrate this method into your image processing workflow
to ensure smoother transitions between colors, resulting in improved overall image
appearance and clarity.

Parameters:

ParameterTypeDescription
dithering_methodDitheringMethodThe dithering method.
bits_countintThe final bits count for dithering.
custom_paletteIColorPaletteThe custom palette for dithering.

Method: filter(rectangle, options)

 filter(rectangle, options) 

Filter the content within the specified rectangle, applying a designated image
processing filter to enhance or modify the selected region. Integrate this method
into your image manipulation workflow to achieve targeted enhancements or
transformations within your application.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle.
optionsFilterOptionsBaseThe options.

Method: get_argb_32_pixel(x, y)

 get_argb_32_pixel(x, y) 

Gets an image 32-bit ARGB pixel.

Parameters:

ParameterTypeDescription
xintThe pixel x location.
yintThe pixel y location.

Returns

TypeDescription
intThe 32-bit ARGB pixel for the specified location.

Method: get_default_argb_32_pixels(rectangle)

 get_default_argb_32_pixels(rectangle) 

Gets the default 32-bit ARGB pixels array.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get pixels for.

Returns

TypeDescription
intThe default pixels array.

Method: get_default_options(args)

 get_default_options(args) 

Gets the default options.

Parameters:

ParameterTypeDescription
argsobjectThe arguments.

Returns

TypeDescription
ImageOptionsBaseDefault options

Method: get_default_pixels(rectangle, partial_pixel_loader)

 get_default_pixels(rectangle, partial_pixel_loader) 

Gets the default pixels array using partial pixel loader.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get pixels for.
partial_pixel_loaderIPartialArgb32PixelLoaderThe partial pixel loader.

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) 

Gets the default raw data array using partial pixel loader.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get pixels for.
partial_raw_data_loaderIPartialRawDataLoaderThe partial raw data loader.
raw_data_settingsRawDataSettingsThe raw data settings.

Method: get_default_raw_data(rectangle, raw_data_settings)

 get_default_raw_data(rectangle, raw_data_settings) 

Gets the default raw data array.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to get raw data for.
raw_data_settingsRawDataSettingsThe raw data settings.

Returns

TypeDescription
byteThe default raw data array.

Method: get_file_format(file_path) [static]

 get_file_format(file_path) 

Gets the file format.

Parameters:

ParameterTypeDescription
file_pathstringThe file path.

Returns

TypeDescription
FileFormatThe determined file format.

Method: get_file_format(stream) [static]

 get_file_format(stream) 

Gets the file format.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream.

Returns

TypeDescription
FileFormatThe determined file format.

Method: get_file_format_of_stream(stream) [static]

 get_file_format_of_stream(stream) 

Gets the file format.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream.

Returns

TypeDescription
FileFormatThe determined file format.

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

 get_fitting_rectangle(rectangle, pixels, width, height) 

Gets rectangle which fits the current image.

Parameters:

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

Returns

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

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

 get_fitting_rectangle(rectangle, width, height) 

Gets rectangle which fits the current image.

Parameters:

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

Returns

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

Method: get_modify_date(use_default)

 get_modify_date(use_default) 

Gets the date and time the resource image was last modified.

Parameters:

ParameterTypeDescription
use_defaultboolif set to true uses the information from FileInfo as default value.

Returns

TypeDescription
datetimeThe date and time the resource image was last modified.

Method: get_original_options()

 get_original_options() 

Retrieve options derived from the original file settings, facilitating seamless
preservation of key parameters such as bit-depth and other essential attributes of
the original image. Utilize this method to maintain fidelity and consistency in
image processing tasks, ensuring optimal results without unnecessary alterations.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
DataStreamSupporter.save(file_path) method, the output PNG image with 8-bit per pixel will be produced.
To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them
to the Image.save(file_path, options) method as the second parameter.

Returns

TypeDescription
ImageOptionsBaseThe options based on the original file settings.

Method: get_pixel(x, y)

 get_pixel(x, y) 

Gets an image pixel.

Parameters:

ParameterTypeDescription
xintThe pixel x location.
yintThe pixel y location.

Returns

TypeDescription
ColorThe pixel color for the specified location.

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

 get_proportional_height(width, height, new_width) 

Gets a proportional height.

Parameters:

ParameterTypeDescription
widthintThe width.
heightintThe height.
new_widthintThe new width.

Returns

TypeDescription
intThe proportional height.

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

 get_proportional_width(width, height, new_height) 

Gets a proportional width.

Parameters:

ParameterTypeDescription
widthintThe width.
heightintThe height.
new_heightintThe new height.

Returns

TypeDescription
intThe proportional width.

Method: get_serialized_stream(image_options, clipping_rectangle, page_number)

 get_serialized_stream(image_options, clipping_rectangle, page_number) 

Converts to aps.

Parameters:

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

Returns

TypeDescription
_io.BufferedRandomThe serialized stream

Method: get_skew_angle()

 get_skew_angle() 

Gets the skew angle.
This method is applicable to scanned text documents, to determine the skew angle when scanning.

Returns

TypeDescription
floatThe skew angle, in degrees.

Method: insert_frame(index, frame_to_insert)

 insert_frame(index, frame_to_insert) 

Insert the new frame at the specified index within the frame sequence, ensuring
precise control over frame arrangement. Employ this method to manage frame
sequences effectively, facilitating dynamic manipulation and organization of image
content within your application.

Parameters:

ParameterTypeDescription
indexintIndex of new frame in list of frames
frame_to_insertTiffFrameThe frame To Insert.

Method: load(file_path) [static]

 load(file_path) 

Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.

Parameters:

ParameterTypeDescription
file_pathstringThe file path or URL to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load(file_path, load_options) [static]

 load(file_path, load_options) 

Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.

Parameters:

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

Returns

TypeDescription
ImageThe loaded image.

Method: load(stream) [static]

 load(stream) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load(stream, load_options) [static]

 load(stream, load_options) 

Loads a new image from the specified stream.

Parameters:

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

Returns

TypeDescription
ImageThe loaded image.

Method: load_argb_32_pixels(rectangle)

 load_argb_32_pixels(rectangle) 

Loads 32-bit ARGB pixels.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.

Returns

TypeDescription
intThe loaded 32-bit ARGB pixels array.

Method: load_argb_64_pixels(rectangle)

 load_argb_64_pixels(rectangle) 

Loads 64-bit ARGB pixels.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.

Returns

TypeDescription
longThe loaded 64-bit ARGB pixels array.

Method: load_cmyk_32_pixels(rectangle)

 load_cmyk_32_pixels(rectangle) 

Loads pixels in CMYK format.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.

Returns

TypeDescription
intThe loaded CMYK pixels presentes as 32-bit inateger values.

Method: load_cmyk_pixels(rectangle)

 load_cmyk_pixels(rectangle) 

Loads pixels in CMYK format.
This method is deprecated. Please use more effective the RasterImage.load_cmyk_32_pixels(rectangle) method.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.

Returns

TypeDescription
CmykColor[]The loaded CMYK pixels array.

Method: load_partial_argb_32_pixels(rectangle, partial_pixel_loader)

 load_partial_argb_32_pixels(rectangle, partial_pixel_loader) 

Loads 32-bit ARGB pixels partially (by blocks).

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.
partial_pixel_loaderIPartialArgb32PixelLoaderThe partial pixel loader.

Method: load_partial_argb_64_pixels(rectangle, partial_pixel_loader)

 load_partial_argb_64_pixels(rectangle, partial_pixel_loader) 

Loads 64-bit ARGB pixels partially by packs.

Parameters:

ParameterTypeDescription
rectangleRectangleThe desired rectangle.
partial_pixel_loaderIPartialArgb64PixelLoaderThe 64-bit ARGB pixel loader.

Method: load_partial_pixels(desired_rectangle, pixel_loader)

 load_partial_pixels(desired_rectangle, pixel_loader) 

Loads pixels partially by packs.

Parameters:

ParameterTypeDescription
desired_rectangleRectangleThe desired rectangle.
pixel_loaderIPartialPixelLoaderThe pixel loader.

Method: load_pixels(rectangle)

 load_pixels(rectangle) 

Loads pixels.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load pixels from.

Returns

TypeDescription
Color[]The loaded pixels array.

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) 

Loads raw data.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load raw data from.
dest_image_boundsRectangleThe dest image bounds.
raw_data_settingsRawDataSettingsThe raw data settings to use for loaded data. Note if data is not in the format specified then data conversion will be performed.
raw_data_loaderIPartialRawDataLoaderThe raw data loader.

Method: load_raw_data(rectangle, raw_data_settings, raw_data_loader)

 load_raw_data(rectangle, raw_data_settings, raw_data_loader) 

Loads raw data.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to load raw data from.
raw_data_settingsRawDataSettingsThe raw data settings to use for loaded data. Note if data is not in the format specified then data conversion will be performed.
raw_data_loaderIPartialRawDataLoaderThe raw data loader.

Method: load_stream(stream) [static]

 load_stream(stream) 

Loads a new image from the specified stream.

Parameters:

ParameterTypeDescription
stream_io.BufferedRandomThe stream to load image from.

Returns

TypeDescription
ImageThe loaded image.

Method: load_stream_with_options(stream, load_options) [static]

 load_stream_with_options(stream, load_options) 

Loads a new image from the specified stream.

Parameters:

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

Returns

TypeDescription
ImageThe loaded image.

Method: load_with_options(file_path, load_options) [static]

 load_with_options(file_path, load_options) 

Loads a new image from the specified file path or URL.
If filePath is a file path the method just opens the file.
If filePath is an URL, the method downloads the file, stores it as a temporary one, and opens it.

Parameters:

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

Returns

TypeDescription
ImageThe loaded image.

Method: normalize_angle(resize_proportionally, background_color)

 normalize_angle(resize_proportionally, background_color) 

Utilize the NormalizeAngle method specifically designed for scanned text documents
to rectify skewed scans, ensuring accurate alignment. Seamlessly
integrate this functionality into your text processing workflows to enhance
document readability and quality, improving overall efficiency in text recognition
and analysis tasks.
This method uses RasterImage.get_skew_angle() and TiffImage.rotate(angle, resize_proportionally, background_color) methods.

Parameters:

ParameterTypeDescription
resize_proportionallyboolif set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.
background_colorColorColor of the background.

Method: read_argb_32_scan_line(scan_line_index)

 read_argb_32_scan_line(scan_line_index) 

Reads the whole scan line by the specified scan line index.

Parameters:

ParameterTypeDescription
scan_line_indexintZero based index of the scan line.

Returns

TypeDescription
intThe scan line 32-bit ARGB color values array.

Method: read_scan_line(scan_line_index)

 read_scan_line(scan_line_index) 

Reads the whole scan line by the specified scan line index.

Parameters:

ParameterTypeDescription
scan_line_indexintZero based index of the scan line.

Returns

TypeDescription
Color[]The scan line pixel color values array.

Method: remove_frame(frame)

 remove_frame(frame) 

Efficiently remove the specified frame from the image sequence, facilitating
streamlined frame management within your application. Integrate this functionality
to enhance precision and flexibility in frame manipulation, ensuring seamless
organization and presentation of image content.

Parameters:

ParameterTypeDescription
frameTiffFrameThe frame to remove.

Method: remove_frame(index)

 remove_frame(index) 

Removes the frame by its index.

Parameters:

ParameterTypeDescription
indexintIndex of frame to be removed.

Returns

TypeDescription
TiffFrameThe removed frame.

Method: remove_frame_by_index(index)

 remove_frame_by_index(index) 

Removes the frame by its index.

Parameters:

ParameterTypeDescription
indexintIndex of frame to be removed.

Returns

TypeDescription
TiffFrameThe removed frame.

Method: replace_argb(old_color_argb, old_color_diff, new_color_argb)

 replace_argb(old_color_argb, old_color_diff, new_color_argb) 

Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.

Parameters:

ParameterTypeDescription
old_color_argbintOld color ARGB value to be replaced.
old_color_diffbyteAllowed difference in old color to be able to widen replaced color tone.
new_color_argbintNew color ARGB value to replace old color with.

Method: replace_color(old_color, old_color_diff, new_color)

 replace_color(old_color, old_color_diff, new_color) 

Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.

Parameters:

ParameterTypeDescription
old_colorColor
old_color_diffbyteAllowed difference in old color to be able to widen replaced color tone.
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) 

Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.

Parameters:

ParameterTypeDescription
old_color_argbintOld color ARGB value to be replaced.
old_color_diffbyteAllowed difference in old color to be able to widen replaced color tone.
new_color_argbintNew color ARGB value to replace old color with.

Method: replace_frame(index, frame_to_replace)

 replace_frame(index, frame_to_replace) 

Substitute the frame at the designated position with another frame seamlessly,
facilitating dynamic frame management within the image sequence. Integrate this
method to enhance flexibility and precision in frame manipulation, ensuring
optimal organization and presentation of image content within your application.

Parameters:

ParameterTypeDescription
indexintThe zero based frame position.
frame_to_replaceTiffFrameThe frame to replace.

Returns

TypeDescription
TiffFrameThe removed frame.

Method: replace_non_transparent_colors(new_color)

 replace_non_transparent_colors(new_color) 

Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
Note: if you use it on images without transparency, all colors will be replaced with a single one.

Parameters:

ParameterTypeDescription
new_colorColor

Method: replace_non_transparent_colors(new_color_argb)

 replace_non_transparent_colors(new_color_argb) 

Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
Note: if you use it on images without transparency, all colors will be replaced with a single one.

Parameters:

ParameterTypeDescription
new_color_argbintNew color ARGB value to replace non transparent colors with.

Method: resize(new_width, new_height)

 resize(new_width, new_height) 

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

Parameters:

ParameterTypeDescription
new_widthintThe new width.
new_heightintThe new height.

Method: resize(new_width, new_height, resize_type)

 resize(new_width, new_height, resize_type) 

Conduct a proportional resize operation on the image, preserving its aspect ratio
while adjusting its dimensions. Employ this method to dynamically scale images
within your application, ensuring consistent visual representation of content
integrity.
The proportional resize will resize each frame according to the ratio of newWidth/width and newHeight/height.

Parameters:

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

Method: resize(new_width, new_height, settings)

 resize(new_width, new_height, settings) 

Resizes the image.

Parameters:

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

Method: resize_by_settings(new_width, new_height, settings)

 resize_by_settings(new_width, new_height, settings) 

Resizes the image.

Parameters:

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

Method: resize_by_type(new_width, new_height, resize_type)

 resize_by_type(new_width, new_height, resize_type) 

Resizes the image.

Parameters:

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

Method: resize_height_proportionally(new_height)

 resize_height_proportionally(new_height) 

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

Parameters:

ParameterTypeDescription
new_heightintThe new height.

Method: resize_height_proportionally(new_height, resize_type)

 resize_height_proportionally(new_height, resize_type) 

Conduct a proportional adjustment of the image’s height, preserving its aspect
ratio for consistent visual integrity. Employ this method to dynamically resize
images within your application, ensuring optimal display across diverse platforms
and devices without compromising content quality.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
resize_typeResizeTypeType of the resize.

Method: resize_height_proportionally(new_height, settings)

 resize_height_proportionally(new_height, settings) 

Resizes the height proportionally.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
settingsImageResizeSettingsThe image resize settings.

Method: resize_height_proportionally_settings(new_height, settings)

 resize_height_proportionally_settings(new_height, settings) 

Resizes the height proportionally.

Parameters:

ParameterTypeDescription
new_heightintThe new height.
settingsImageResizeSettingsThe image resize settings.

Method: resize_proportional(new_width, new_height, resize_type)

 resize_proportional(new_width, new_height, resize_type) 

Conduct a proportional resize operation on the image, preserving its aspect ratio
while adjusting its dimensions. Employ this method to dynamically scale images
within your application, ensuring consistent visual representation of content
integrity.
The proportional resize will resize each frame according to the ratio of newWidth/width and newHeight/height.

Parameters:

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

Method: resize_width_proportionally(new_width)

 resize_width_proportionally(new_width) 

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

Parameters:

ParameterTypeDescription
new_widthintThe new width.

Method: resize_width_proportionally(new_width, resize_type)

 resize_width_proportionally(new_width, resize_type) 

Adjust the width of the image while maintaining its aspect ratio, ensuring
proportional resizing for optimal visual presentation. Utilize this method to
dynamically scale images within your application, facilitating consistent and
aesthetically pleasing rendering across various display contexts.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
resize_typeResizeTypeType of the resize.

Method: resize_width_proportionally(new_width, settings)

 resize_width_proportionally(new_width, settings) 

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
settingsImageResizeSettingsThe image resize settings.

Method: resize_width_proportionally_settings(new_width, settings)

 resize_width_proportionally_settings(new_width, settings) 

Resizes the width proportionally.

Parameters:

ParameterTypeDescription
new_widthintThe new width.
settingsImageResizeSettingsThe image resize settings.

Method: rotate(angle)

 rotate(angle) 

Rotate image around the center.

Parameters:

ParameterTypeDescription
anglefloatThe rotate angle in degrees. Positive values will rotate clockwise.

Method: rotate(angle, resize_proportionally, background_color)

 rotate(angle, resize_proportionally, background_color) 

Rotate the image around its center point by a specified angle, enabling precise
orientation adjustments. Incorporate this functionality into your image processing
pipeline to facilitate accurate transformations, ensuring optimal alignment and
presentation of visual content within your application.

Parameters:

ParameterTypeDescription
anglefloatThe rotate angle in degrees. Positive values will rotate clockwise.
resize_proportionallyboolif set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.
background_colorColorColor of the background.

Method: rotate_flip(rotate_flip_type)

 rotate_flip(rotate_flip_type) 

Perform rotation, flipping, or a combination of both operations exclusively on the
active frame. This method allows precise manipulation of individual frames within
the image sequence, enhancing flexibility in image editing and composition within
your application.

Parameters:

ParameterTypeDescription
rotate_flip_typeRotateFlipTypeThe rotate flip type.

Method: rotate_flip_all(rotate_flip)

 rotate_flip_all(rotate_flip) 

Rotates the flip all.

Parameters:

ParameterTypeDescription
rotate_flipRotateFlipTypeThe rotate flip.

Method: save(file_path)

 save(file_path) 

Saves the image to the specified file location.

Parameters:

ParameterTypeDescription
file_pathstringThe file path to save the image to.

Method: save(file_path, options)

 save(file_path, options) 

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

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.

Method: save(file_path, options, bounds_rectangle)

 save(file_path, options, bounds_rectangle) 

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

Parameters:

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

Method: save(file_path, over_write)

 save(file_path, over_write) 

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

Parameters:

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

Method: save(stream)

 save(stream) 

Saves the object’s data to the specified stream.

Parameters:

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

Method: save(stream, options_base)

 save(stream, options_base) 

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

Parameters:

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

Method: save(stream, options_base, bounds_rectangle)

 save(stream, options_base, bounds_rectangle) 

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

Parameters:

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

Method: save_argb_32_pixels(rectangle, pixels)

 save_argb_32_pixels(rectangle, pixels) 

Saves the 32-bit ARGB pixels.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to save pixels to.
pixelsintThe 32-bit ARGB pixels array.

Method: save_cmyk_32_pixels(rectangle, pixels)

 save_cmyk_32_pixels(rectangle, pixels) 

Saves the pixels.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to save pixels to.
pixelsintThe CMYK pixels presented as the 32-bit integer values.

Method: save_cmyk_pixels(rectangle, pixels)

 save_cmyk_pixels(rectangle, pixels) 

Saves the pixels.
This method is deprecated. Please use more effective the RasterImage.save_cmyk_32_pixels(rectangle, pixels) method.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle to save pixels to.
pixelsCmykColor[]The CMYK pixels array.

Method: save_pixels(rectangle, pixels)

 save_pixels(rectangle, pixels) 

Saves the pixels internal main.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle.
pixelsColor[]The pixels.

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

 save_raw_data(data, data_offset, rectangle, raw_data_settings) 

Saves the raw data.

Parameters:

ParameterTypeDescription
databyteThe raw data.
data_offsetintThe starting raw data offset.
rectangleRectangleThe raw data rectangle.
raw_data_settingsRawDataSettingsThe raw data settings the data is in.

Method: save_to_stream(stream)

 save_to_stream(stream) 

Saves image to stream

Parameters:

ParameterTypeDescription
stream_io.BufferedRandom

Method: save_to_stream_with_options(stream, options_base)

 save_to_stream_with_options(stream, options_base) 

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

Parameters:

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

Method: save_to_stream_with_options_rect(stream, options_base, bounds_rectangle)

 save_to_stream_with_options_rect(stream, options_base, bounds_rectangle) 

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

Parameters:

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

Method: save_with_options(file_path, options)

 save_with_options(file_path, options) 

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

Parameters:

ParameterTypeDescription
file_pathstringThe file path.
optionsImageOptionsBaseThe options.

Method: save_with_options_rect(file_path, options, bounds_rectangle)

 save_with_options_rect(file_path, options, bounds_rectangle) 

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

Parameters:

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

Method: set_argb_32_pixel(x, y, argb_32_color)

 set_argb_32_pixel(x, y, argb_32_color) 

Sets an image 32-bit ARGB pixel for the specified position.

Parameters:

ParameterTypeDescription
xintThe pixel x location.
yintThe pixel y location.
argb_32_colorintThe 32-bit ARGB pixel for the specified position.

Method: set_palette(palette, update_colors)

 set_palette(palette, update_colors) 

Sets the image palette.

Parameters:

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

Method: set_pixel(x, y, color)

 set_pixel(x, y, color) 

Sets an image pixel for the specified position.

Parameters:

ParameterTypeDescription
xintThe pixel x location.
yintThe pixel y location.
colorColorThe pixel color for the specified position.

Method: set_resolution(dpi_x, dpi_y)

 set_resolution(dpi_x, dpi_y) 

Establishes the resolution for the specified RasterImage, enabling
precise control over image rendering and display properties. Integrate this
functionality to optimize visual output and ensure compatibility with diverse
output devices and platforms, enhancing the overall user experience.

Parameters:

ParameterTypeDescription
dpi_xdoubleThe horizontal resolution, in dots per inch, of the RasterImage.
dpi_ydoubleThe vertical resolution, in dots per inch, of the RasterImage.

Method: write_argb_32_scan_line(scan_line_index, argb_32_pixels)

 write_argb_32_scan_line(scan_line_index, argb_32_pixels) 

Writes the whole scan line to the specified scan line index.

Parameters:

ParameterTypeDescription
scan_line_indexintZero based index of the scan line.
argb_32_pixelsintThe 32-bit ARGB colors array to write.

Method: write_scan_line(scan_line_index, pixels)

 write_scan_line(scan_line_index, pixels) 

Writes the whole scan line to the specified scan line index.

Parameters:

ParameterTypeDescription
scan_line_indexintZero based index of the scan line.
pixelsColor[]The pixel colors array to write.

Examples

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)
	# Binarize the image with a threshold value of 127.
	# If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
	tiff_image.binarize_fixed(127)
	tiff_image.save(join(dir_, "sample.BinarizeFixed.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)
	# Set gamma coefficient for red, green and blue channels.
	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)
	# Set individual gamma coefficients for red, green and blue channels.
	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)
	# Set the brightness value. The accepted values of brightness are in the range [-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)
	# Set the contrast value. The accepted values of contrast are in the range [-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:
	# Create the GraphicsPath using PathResources from TIFF image
	active_frame = image.active_frame
	graphics_path = PathResourceConverter.to_graphics_path(active_frame.path_resource, active_frame.size)
	graphics = Graphics(image)
	# Draw red line and save the image
	graphics.draw_path(Pen(Color.red, 10), graphics_path)
	image.save("BottleWithRedBorder.tif")