Extract the text from an image by using the OCR (Optical Character Recognition) Text component in RPA Desktop Design Studio.

Before you begin

Role required: none

About this task

Important:

Starting with the Yokohama release, the RPA Desktop Design Studio utilizes the latest version of the Tesseract OCR engine. This update improves image pre-processing, and performance optimizations. When updating older automations that include the OCR text component, you may notice slight differences in the output. Therefore, it’s important to validate your automations after the update.

Many properties of the OCR Text component are common with other Actions UI components, to configure these properties, see Properties of Actions (UI) components.

The properties unique to the OCR Text component are given.
Table 1. OCR Text component properties
Property Text
Image Source Source from which the component takes the image.

Procedure

  1. In the Toolbox pane, navigate to Actions (UI) > OCR Text.
  2. Drag the OCR Text component to the Design surface.
  3. (Optional) To configure the settings, click the component settings icon (Component settings icon.).
    The component has default settings that you may review and use.
  4. (Optional) Configure the settings as described in the following table.
    Table 2. OCR Settings
    Field Description
    Engine Engine name that is used for extracting the OCR fields.
    Language Teseract engine that can support multiple languages. The user can select any language that is listed here.
    Line Height Tolerance Font line height.
    ChangeDPI Changes the Dots Per Inch (DPI) of Image as mentioned in the DPI property.
    DPI DPI value.
    Extract Words Text that is extracted in a word format. Otherwise, it's plain text.
    Invert Image color that is inverted. For example, it inverts black to white.
    Language Language that is used to extract.
    Scale Image Scales the image by the given number.
    Threshold Image that is converted out of Grayscale image or noise that is removed as per the threshold value.
    Threshold Value Threshold value.
    Timeout Time after which the component operation times out.
  5. To close the OCR Settings window, click OK.
  6. To configure the input, see Configure port properties.
  7. To configure the output, see Configure output port properties.
  8. (Optional) Connect the ports as described in the following table.
    Port Type Port name Data type Purpose Notes
    Data In Image/File Path Bitmap/String Takes the image or the path to the image. The input depends on the option selected from the Image Sourceoption in the Properties.
    • Port: The data type is Bitmap.
    • File Path: The data type is String.
    Data Out Text String Returns the extracted text from the image.
    Data Out Confidence Single Returns the extracted text accuracy figure.
  9. To test the component, right-click the component bar and then click Run From Here.

Example: Extract text from images and display with the Show component

Extract text from image and display with the Show component.

The OCR Text component takes a path to an image. The image comprises the text "servicenow". The component extracts the text from the image and passes the string to the Show component (To use the Show component, see Use the Show component). The Show component takes the text through the Message Data In port and then displays the text in a window.