This is UltimateRPA Documentation
urpa.TransformationFactory Class Reference

An auxiliary class that defines how images are to be transformed. More...

Inheritance diagram for urpa.TransformationFactory:
urpa.Transformation

Public Member Functions

def change_colors (self, from_colors, to_color)
 This method prepares the transformation of the color list to a specific color. More...
 
def colors_inversion (self)
 This method prepares the transformation of colors to their inverse value. More...
 
def threshold (self, threshold)
 The method prepares for bitmap transformation to a bitmap (black and white only). More...
 

Detailed Description

An auxiliary class that defines how images are to be transformed.

Member Function Documentation

◆ change_colors()

def urpa.TransformationFactory.change_colors (   self,
  from_colors,
  to_color 
)

This method prepares the transformation of the color list to a specific color.

Parameters
from_colorsa color list where the components are a tuple, the elements of which comprise three integers with a value from 0 to 255, for example [(255, 255, 255), (128, 128, 128)]
to_colora tuple, the elements of which comprise three integers with a value from 0 to 255, for example (0, 0, 0)
Returns
Returns a Transformation-type object

Examples

Example
element = app.find_first(cf.name("Red Rectangle"))
timeout = 30000
# Create transformation factory.
# Define the list of colors to be converted.
from_colors = [(0, 255, 0), (0, 254, 0)]
# Define the color to which colors from the list are to be changed.
to_color = (255, 255, 255)
# Define transformation factory.
transformation = tf.change_color(from_colors, to_color)
visual = element.find_first_visual("img/template.bmp", (20, 30, 45, 50), timeout, transformation)

◆ colors_inversion()

def urpa.TransformationFactory.colors_inversion (   self)

This method prepares the transformation of colors to their inverse value.

Returns
Returns a Transformation-type object

Examples

Example
element = app.find_first(cf.name("Red Rectangle"))
timeout = 30000
# Create transformation factory.
# Define transformation factory.
transformation = tf.colors_inversion()
visual = element.find_first_visual("img/template.bmp", (20, 30, 45, 50), timeout, transformation)

◆ threshold()

def urpa.TransformationFactory.threshold (   self,
  threshold 
)

The method prepares for bitmap transformation to a bitmap (black and white only).

Parameters
thresholdfloat, e.g. 0.5 A value from 0 to 1, indicating at what ratio the range between 0 and 255 is to be divided into two groups.
Returns
Returns a Transformation-type object

Examples

Example
element = app.find_first(cf.name("Red Rectangle"))
timeout = 30000
# Create transformation factory.
# Define transformation factory.
transformation = tf.threshold(0.4)
visual = element.find_first_visual("img/template.bmp", (20, 30, 45, 50), timeout, transformation)

The documentation for this class was generated from the following file: