Skip to main content


Command Description

Use Laiye IDP to identify text in the specified image, and return result in JSON format

Command Prototype

jsonRet = Mage.ImageOCRText(path,config,time)

Parameter Description

pathTruepath'''C:\Users'''Paths of images in jpeg, jpg, png, bmp, tif, tiff and other formats are supported to be identified. Only homepage recognition is supported for PDF files
configTrueexpression{}Call configuration of Laiye IDP
timeTruenumber30000Specify the waiting time in milliseconds. If exceeded, an exception will be thrown. Default: 30,000 milliseconds (30 seconds)


jsonRet,The variable used to save the output of the command.


Dim path='''C:\Users'''  // The path of the image to be recognized 
Dim config={"Pubkey":"","Secret":"","Url":""} // Get from mage

TracePrint "--------------------Image text recognition--------------------"
// --------------------------------------------------------
// [Remarks] Identify the text content of the specified target on the screen
// Input parameter 1:
// path--The path of the image to be recognized.Type:String
// Input parameter 2:
// config--mage configuration, need to configure Pubkey and Secret.Type:Dict
// Input parameter 3:
// time--timeout time. Default unit: milliseconds. Type: Int

// Output parameters:
// jsonRet: The variable to which the output of the function call is saved

// Command prototype: jsonRet = Mage.ImageOCRText(path,config,time)
// --------------------------------------------------------

jsonRet = Mage.ImageOCRText(path,config,30000)