class Abbyy::Models::ProcessImageRequest

Overview

Request object for /processImage API-method.

Included Modules

Defined in:

abbyy/models/process_image_request.cr

Constant Summary

ALLOWED_EXPORT_FORMATS = ExportFormat.values - [ExportFormat::V_Card, ExportFormat::Csv]
ALLOWED_PROFILES = Profile.values - [Profile::FieldLevelRecognition]
ALLOWED_TEXT_TYPES = TextType.values - [TextType::Handprinted]
DEFAULT_CORRECT_ORIENTATION = true
DEFAULT_CORRENT_SKEW = true
DEFAULT_DESCRITION = ""
DEFAULT_EXPORT_FORMAT = ExportFormat::Rtf
DEFAULT_IMAGE_SOURCE = ImageSource::Auto
DEFAULT_LANGUAGE = Language::English
DEFAULT_PDF_PASSWORD = ""
DEFAULT_PDF_WRITE_TAGS = PdfWriteTag::Auto
DEFAULT_PROFILE = Profile::DocumentConversion
DEFAULT_READ_BARCODES = true
DEFAULT_TEXT_TYPE = TextType::Normal
DEFAULT_XML_WRITE_RECOGNITION_VARIANTS = false

Constructors

Instance Method Summary

Instance methods inherited from module Abbyy::Models::FileBody

body : HTTP::Client::BodyType body, file_path : String file_path, file_path=(file_path : String) file_path=

Constructor methods inherited from module Abbyy::Models::FileBody

new(file_path : String) new

Instance methods inherited from class Abbyy::Models::BaseRequest

body : HTTP::Client::BodyType body, params : Hash(String, String) params

Constructor Detail

def self.new(file_path : String, language : Language | Array(Language) | Nil = nil, profile : Profile | Nil = nil, text_type : TextType | Array(TextType) | Nil = nil, image_source : ImageSource | Nil = nil, correct_orientation : Bool | Nil = nil, correct_skew : Bool | Nil = nil, read_barcodes : Bool | Nil = nil, export_format : ExportFormat | Array(ExportFormat) | Nil = nil, xml_write_recognition_variants : Bool | Nil = nil, pdf_write_tags : PdfWriteTag | Nil = nil, description : String | Nil = nil, pdf_password : String | Nil = nil) #

[View source]

Instance Method Detail

def correct_orientation : Bool | Nil #

Specifies whether the orientation of the image should be automatically detected and corrected. It can have one of the following values:

  • true The page orientation is automatically detected, and if it differs from normal the image is rotated.
  • false The page orientation detection and correction is not performed.

This parameter is not required.

Default value is true.


[View source]
def correct_orientation=(correct_orientation : Bool | Nil) #

Specifies whether the orientation of the image should be automatically detected and corrected. It can have one of the following values:

  • true The page orientation is automatically detected, and if it differs from normal the image is rotated.
  • false The page orientation detection and correction is not performed.

This parameter is not required.

Default value is true.


[View source]
def correct_skew : Bool | Nil #

Specifies whether the skew of the image should be automatically detected and corrected. It can have either true or false value.

This parameter is not required.

Default value is true.


[View source]
def correct_skew=(correct_skew : Bool | Nil) #

Specifies whether the skew of the image should be automatically detected and corrected. It can have either true or false value.

This parameter is not required.

Default value is true.


[View source]
def description : String | Nil #

Contains the description of the processing task. Cannot contain more than 255 characters.

This parameter is not required.


[View source]
def description=(description : String | Nil) #

[View source]
def export_format : ExportFormat | Array(ExportFormat) | Nil #

Specifies the export format. This parameter can contain up to three export formats, in an array for example:

[ExportFormat::Pdfa, ExportFormat::Txt, ExportFormat::Xml]

The available formats are:

  • ExportFormat::Txt The recognized text is exported to the file line by line from left to right. E.g. if the text was originally put in columns, the first lines of every column will be saved, then the second lines, etc. Please take into account the fact that in this format only text will be saved. No images or barcodes will remain in the output file. If you want to save the barcode recognition results in the exported file, use the ExportFormat::TxtUnstructured format.
  • ExportFormat::TxtUnstructured The exported file contains the text that was saved according to the order of the original blocks.
  • ExportFormat::Rtf
  • ExportFormat::Docx
  • ExportFormat::Xlsx
  • ExportFormat::Pptx
  • ExportFormat::PdfSearchable The entire image is saved as a picture, the recognized text is put under it.
  • ExportFormat::PdfTextAndImages The recognized text is saved as text, and the pictures are saved as pictures.
  • `ExportFormat::Pdfa The file is saved in the PDF/A-1b format, with the entire image saved as a picture, and recognized text put under it.
  • ExportFormat::Xml
  • `ExportFormat::XmlForCorrectedImage The same as Xml, but all coordinates written into the output XML file relate to the corrected image, not the original.
  • ExportFormat::Alto

If either of XML export formats is selected, barcodes are recognized on the image and saved to output XML no matter which profile is used for recognition.

Please note that setting multiple export formats does not affect the cost of task processing.

This parameter is not required.

Default value is ExportFormat::Rtf.


[View source]
def export_format=(export_format : ExportFormat | Array(ExportFormat) | Nil) #

[View source]
def image_source : ImageSource | Nil #

Specifies the source of the image. It can be either a scanned image, or a photograph created with a digital camera. Special preprocessing operations can be performed with the image depending on the selected source. For example, the system can automatically correct distorted text lines, poor focus and lighting on photos.

The value of this parameter can be one of the following:

This parameter is not required.

Default value is ImageSource::Auto.


[View source]
def image_source=(image_source : ImageSource | Nil) #

Specifies the source of the image. It can be either a scanned image, or a photograph created with a digital camera. Special preprocessing operations can be performed with the image depending on the selected source. For example, the system can automatically correct distorted text lines, poor focus and lighting on photos.

The value of this parameter can be one of the following:

This parameter is not required.

Default value is ImageSource::Auto.


[View source]
def language : Language | Array(Language) | Nil #

Specifies recognition language of the document. This parameter can contain one language or several languages in an array, for example:

request.language = Language::Spanish
# or
request.language = [
  Language::English,
  Language::French,
  Language::German,
]

See the list of available recognition languages.

This parameter is not required.

Default value is Language::English.


[View source]
def language=(language : Language | Array(Language) | Nil) #

Specifies recognition language of the document. This parameter can contain one language or several languages in an array, for example:

request.language = Language::Spanish
# or
request.language = [
  Language::English,
  Language::French,
  Language::German,
]

See the list of available recognition languages.

This parameter is not required.

Default value is Language::English.


[View source]
def params : Hash(String, String) #

[View source]
def pdf_password : String | Nil #

Contains a password for accessing password-protected images in PDF format.

This parameter is not required.


[View source]
def pdf_password=(pdf_password : String | Nil) #

Contains a password for accessing password-protected images in PDF format.

This parameter is not required.


[View source]
def pdf_write_tags : PdfWriteTag | Nil #

Specifies whether the result must be written as tagged PDF. This parameter can be used only if the exportFormat parameter contains one of the values for export to PDF. It can have one of the following values:

This parameter is not required.

Default value is PdfWriteTag::Auto.


[View source]
def pdf_write_tags=(pdf_write_tags : PdfWriteTag | Nil) #

Specifies whether the result must be written as tagged PDF. This parameter can be used only if the exportFormat parameter contains one of the values for export to PDF. It can have one of the following values:

This parameter is not required.

Default value is PdfWriteTag::Auto.


[View source]
def profile : Profile | Nil #

Specifies a profile with predefined processing settings. It can be one of the following:

This parameter is not required.

Default value is Profile::DocumentConversion.


[View source]
def profile=(profile : Profile | Nil) #

[View source]
def read_barcodes : Bool | Nil #

Specifies whether barcodes must be detected on the image, recognized and exported to the result file. It can have either true or false value.

This parameter is not required.

Default value is true for Xml export format and false in other cases.


[View source]
def read_barcodes=(read_barcodes : Bool | Nil) #

Specifies whether barcodes must be detected on the image, recognized and exported to the result file. It can have either true or false value.

This parameter is not required.

Default value is true for Xml export format and false in other cases.


[View source]
def text_type : TextType | Array(TextType) | Nil #

Specifies the type of the text on a page. This parameter may also contain several text types in an array, for example:

[TextType::Normal, TextType::Matrix]

The following values can be used:

  • TextType::Normal
  • TextType::Typewriter
  • TextType::Matrix
  • TextType::Index
  • TextType::OcrA
  • TextType::OcrB
  • TextType::E13b
  • TextType::Cmc7
  • TextType::Gothic

This parameter is not required.

Default value is TextType::Normal.


[View source]
def text_type=(text_type : TextType | Array(TextType) | Nil) #

[View source]
def xml_write_recognition_variants : Bool | Nil #

Specifies whether the variants of characters recognition should be written to an output file in XML format. This parameter can be used only if the #export_format parameter contains ExportFormat::Xml value. The parameter can have one of the following values:

  • true
  • false

[View source]
def xml_write_recognition_variants=(xml_write_recognition_variants : Bool | Nil) #

Specifies whether the variants of characters recognition should be written to an output file in XML format. This parameter can be used only if the #export_format parameter contains ExportFormat::Xml value. The parameter can have one of the following values:

  • true
  • false

[View source]