Sending image for font identification
To identify a font in a scan or photo, send a POST request to the https://api.aspose.cloud/v5.0/ocr/IdentifyFont
Aspose.OCR Cloud REST API endpoint. To authorize the request, pass the access token in Authorization header (Bearer authentication).
The image and font detection parameters are provided in JSON format in the request body.
{
"image": "Base64 string",
"settings": {
"language": "English",
"makeSkewCorrect": true,
"rotate": 0,
"makeBinarization": false,
"makeContrastCorrection": true,
"makeUpsampling": false,
"resultType": "Text"
}
}
Providing an image
Photo or scan is provided in a value of image
property as a Base64 encoded string.
getconf ARG_MAX
command to check the maximum length of the command arguments (in bytes).
Font identification settings
Property | Type | Default value | Description |
---|---|---|---|
language |
string | English |
Specify a language for font identification. |
makeSkewCorrect |
boolean | true |
Automatically correct image tilt (deskew) before proceeding to font identification. Automatic deskew works for images rotated 15 degrees or less. If the scan or photo is rotated by a larger degree or upside down, you must manually specify the rotation angle. |
rotate |
integer | 0 |
Rotate an image by the specified degree. Should be used when the image is rotated by a significant angle or turned upside down. |
makeBinarization |
boolean | false |
Automatically convert an image to black and white before proceeding to font identification. |
makeContrastCorrection |
boolean | true |
Automatically increase the contrast of an image before proceeding to font identification. |
makeUpsampling |
boolean | false |
Intellectually upscale an image to improve small font detection, for example in food labels. |
resultType |
string | Text |
The result of font identification is always returned as a JSON string, so the value of this parameter must be Text . |
Image preprocessing order
If image preprocessing filters are enabled, they are applied one after the other in the following order:
- Contrast correction (
"makeContrastCorrection": true
) - Skew correction (
"makeSkewCorrect": true
) - Upsampling (
"makeUpsampling": true
)
If you want to apply preprocessing filters in another order, disable the corresponding font identification settings and use self-managed preprocessing.
Return value
If successful, this method returns a string with a unique identifier (GUID) of the font identification request in the queue.
Otherwise, it returns a HTTP status code corresponding to the error.
What’s next
Font identification will take a few seconds, depending on the size of the image file and the current Aspose.Cloud load. See the article Fetching font identification result for information on how to get a font identification result from the server.