diff --git a/packages/recognition/pyproject.toml b/packages/recognition/pyproject.toml index 5ebb7f64ad..2ad68d6170 100644 --- a/packages/recognition/pyproject.toml +++ b/packages/recognition/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "rpaframework-recognition" -version = "5.2.6" +version = "5.2.7" description = "OCR capabilities used by RPA Framework" authors = ["RPA Framework "] license = "Apache-2.0" diff --git a/packages/recognition/src/RPA/recognition/ocr.py b/packages/recognition/src/RPA/recognition/ocr.py index fabee1ffa5..1f5130a91d 100644 --- a/packages/recognition/src/RPA/recognition/ocr.py +++ b/packages/recognition/src/RPA/recognition/ocr.py @@ -76,9 +76,14 @@ def find( region = geometry.to_region(region) image = image.crop(region.as_tuple()) + params = {} + if language: + params["lang"] = language + if configuration: + params["config"] = configuration try: data = pytesseract.image_to_data( - image, lang=language, config=configuration, output_type=pytesseract.Output.DICT + image, **params, output_type=pytesseract.Output.DICT ) except TesseractNotFoundError as err: raise EnvironmentError(INSTALL_PROMPT) from err