Skip to content

Commit 2872068

Browse files
committed
Release 23.6.0
1 parent 76d532f commit 2872068

File tree

13 files changed

+660
-292
lines changed

13 files changed

+660
-292
lines changed

ocr/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ Even the complex recognition tasks can be done with a couple of API calls. You d
3737
Master Aspose.OCR Cloud API and and build your own cross-platform OCR applications.
3838
- [How-to's](/ocr/how-to/)
3939
Find answers to the most common questions you may have when using Aspose.OCR Cloud.
40-
- [Release Notes](https://releases.aspose.cloud/ocr/release-notes/)
40+
- [Release Notes](/ocr/release-notes/)
4141
Read a summary of recent changes, enhancements and bug fixes in Aspose.OCR Cloud.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
weight: 95
3+
date: "2023-06-27"
4+
author: "Vladimir Lapin"
5+
type: docs
6+
url: /identify-fonts/
7+
feedback: OCRCLOUD
8+
title: Font identification
9+
description: Identifying fonts and styles in an image using the Aspose.OCR Cloud API.
10+
keywords:
11+
- OCR
12+
- font
13+
- style
14+
- bold
15+
- italic
16+
- typeface
17+
- detect
18+
---
19+
20+
Have you ever been inspired by a font in an image and wondered how to find typefaces in a similar style? Got a sample image from a customer with no reference to the font used? Wanted the best way to put a text overlay on top of the original image?
21+
22+
Aspose.OCR Cloud offers a special API for detecting fonts in a scanned or photographed image. Identification is done in 3 API calls:
23+
24+
1. [Get access token](/ocr/authorization/)
25+
2. [Send image for font identification](/ocr/send-image-for-font-identification/)
26+
3. [Fetch font identification results](/ocr/fetch-font-identification-result/)
27+
28+
Because Aspose.OCR Cloud is provided as a REST API, font identification can be performed from any platform with Internet access.
29+
30+
Aspose also provides open-source [SDKs](/ocr/font-identification-sdk/) for all popular programming languages, that wrap all routine font identification operations into a few native methods. It makes interaction with Aspose.OCR Cloud services much easier, allowing you to focus on the task at hand rather than technical details.
31+
32+
{{% alert color="primary" %}}
33+
Make sure the application has access to the **api.aspose.cloud** domain.
34+
{{% /alert %}}
35+
36+
## Supported typefaces
37+
38+
- Arial,
39+
- Bodoni,
40+
- Calibri,
41+
- Cambria,
42+
- Caslon,
43+
- Century,
44+
- Comic Sans MS,
45+
- Courier,
46+
- Futura,
47+
- Garamond,
48+
- Geneva,
49+
- Georgia,
50+
- GothamBook,
51+
- Gothic,
52+
- Grotesk,
53+
- Helvetica,
54+
- Impact,
55+
- Rockwell,
56+
- Tahoma,
57+
- Times,
58+
- Verdana.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
weight: 20
3+
date: "2023-06-27"
4+
author: "Vladimir Lapin"
5+
type: docs
6+
url: /fetch-font-identification-result/
7+
feedback: OCRCLOUD
8+
title: Fetching font identification result
9+
description: How to get the font identification result from the Aspose.OCR Cloud queue.
10+
keywords:
11+
- queue
12+
- get
13+
- obtain
14+
- fetch
15+
- result
16+
- font
17+
- style
18+
- bold
19+
- italic
20+
- typeface
21+
---
22+
23+
When an image is [submitted](/ocr/send-image-for-font-identification/) for font detection, it is [queued](/ocr/recognition-workflow/) to ensure a stable response even under high load. To obtain the result, send a **GET** 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](/ocr/authorization/) in **Authorization** header (_Bearer authentication_).
24+
25+
Provide the [unique identifier](/ocr/send-image-for-font-identification/#return-value) of the font identification task in `id` parameter:
26+
27+
```bash
28+
curl --location --request GET 'https://api.aspose.cloud/v5.0/ocr/IdentifyFont?id=c11c975d-5124-4555-9561-af40fb95ba07' \
29+
--header 'Accept: text/plain' \
30+
--header 'Content-Type: application/json' \
31+
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...HaRYOxBcCRCPLnrFCVXpw7UA' \
32+
```
33+
34+
## Font identification results
35+
36+
The font identification result is returned in JSON format in the response body.
37+
38+
```json
39+
{
40+
"id": "c11c975d-5124-4555-9561-af40fb95ba07",
41+
"responseStatusCode": "Ok",
42+
"taskStatus": "Completed",
43+
"results": [
44+
{
45+
"type": "Text",
46+
"data": "eydzdHlsZSc6ICdyZWd1bGFyJywgJ2ZvbnQnOiBbJ3RhaG9tYScsICd0aW1lcycsICd2ZXJkYW5hJ119"
47+
}
48+
],
49+
"error": null
50+
}
51+
```
52+
53+
{{% alert color="primary" %}}
54+
Font identification results are stored in the Aspose cloud and can be obtained by the task ID within **24 hours** after the image was sent for font identification.
55+
{{% /alert %}}
56+
57+
Property | Type | Description
58+
-------- | ---- | -----------
59+
`id` | string | Unique identifier of the font identification task. Equals to the value of the `id` request property.
60+
`taskStatus` | string | [Current state](#task-statuses) of the font identification task in the queue.
61+
`responseStatusCode` | string | Font identification response status.
62+
`results` | array | The list of fonts and styles in JSON format, encoded as Base64 string. You must decode it to display on the screen or save to a file.
63+
`error/messages` | string[] | Font identification error messages, if any.<br />Even if the results are returned, you can still get notifications and warnings about non-fatal font identification errors.
64+
65+
### Detected fonts and styles
66+
67+
The list of fonts and styles is returned in JSON format:
68+
69+
```json
70+
{
71+
'style': 'regular',
72+
'font': ['tahoma', 'times', 'verdana']
73+
}
74+
```
75+
76+
Property | Type | Description
77+
-------- | ---- | -----------
78+
`style` | string | The most common style used in text.
79+
`font` | array | The list of fonts used on the image, in order of best matching.
80+
81+
## Task statuses
82+
83+
Font identification may take up to several seconds depending on the Aspose.OCR cloud load and the size of the original scan or photo. The status of the font identification task is indicated in the `taskStatus` property of the font identification result.
84+
85+
Status code | Description | To do
86+
----------- | ----------- | ------
87+
Pending | The image is queued for font identification, but not yet processed. | Try fetching the result in a couple of seconds using the same ID.
88+
Processing | Aspose.OCR Cloud is currently identifying fonts in an image. | Fetch the result again using the same ID.
89+
Completed | The fonts have been identified. | Read the font identification result from `results` property.
90+
Error | An error occurred during font identification. | Check messages in the `error` property for more information.
91+
NotExist | The request with the specified ID does not exist, or the result has already been deleted from the cloud storage. | Check the ID or [send the image for font identification](/ocr/send-image-for-font-identification/) again with the same parameters.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
weight: 30
3+
date: "2023-06-30"
4+
author: "Vladimir Lapin"
5+
type: docs
6+
url: /font-identification-sdk/
7+
feedback: OCRCLOUD
8+
title: Font identification with Aspose.OCR Cloud SDK
9+
description: How to use Aspose.OCR Cloud SDK for identifying fonts in images.
10+
keywords:
11+
- OCR
12+
- recognize
13+
- programming
14+
- development
15+
- SDK
16+
- font
17+
- style
18+
- bold
19+
- italic
20+
- typeface
21+
---
22+
23+
Although you can directly call the Aspose.OCR Cloud REST API to [send image for font identification](/ocr/send-image-for-font-identification/) and [fetch font identification result](/ocr/fetch-font-identification-result/), there is a much easier way to implement font identification functionality in your applications. We provide software development kits (SDKs) for all popular programming languages. They wrap up all routine operations such as establishing connections, sending API requests, and parsing responses into a few simple methods. It makes interaction with Aspose.OCR Cloud services much easier, allowing you to focus on business logic rather than technical details.
24+
25+
{{< tabs tabID="1" tabTotal="1" tabName1=".NET" >}}
26+
27+
{{< tab tabNum="1" >}}
28+
```csharp
29+
using Aspose.OCR.Cloud.SDK.Api;
30+
using Aspose.OCR.Cloud.SDK.Model;
31+
using System.Text;
32+
33+
namespace Example
34+
{
35+
internal class Program
36+
{
37+
static void Main(string[] args)
38+
{
39+
/** Authorize your requests to Aspose.OCR Cloud API */
40+
IdentifyFontApi fontIdentificationApi = new IdentifyFontApi("<Client Id>", "<Client Secret>");
41+
/** Read the image to array of bytes */
42+
byte[] image = File.ReadAllBytes("source.png");
43+
/** Specify recognition settings */
44+
OCRSettingsRecognizeFont recognitionSettings = new OCRSettingsRecognizeFont {
45+
ResultType = ResultType.Text
46+
};
47+
/** Send image for font detection */
48+
OCRRecognizeFontBody source = new OCRRecognizeFontBody(image, recognitionSettings);
49+
string taskID = fontIdentificationApi.PostIdentifyFont(source);
50+
/** Fetch recognition result */
51+
OCRResponse result = fontIdentificationApi.GetIdentifyFont(taskID);
52+
Console.WriteLine(Encoding.UTF8.GetString(result.Results[0].Data));
53+
}
54+
}
55+
}
56+
```
57+
58+
Visit our GitHub repository for a working code and sample files: https://github.com/aspose-ocr-cloud/aspose-ocr-cloud-dotnet
59+
{{< /tab >}}
60+
61+
{{< /tabs >}}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
weight: 10
3+
date: "2023-06-27"
4+
author: "Vladimir Lapin"
5+
type: docs
6+
url: /send-image-for-font-identification/
7+
feedback: OCRCLOUD
8+
title: Sending image for font identification
9+
description: How to send a photo or scan for font identification to the Aspose.OCR Cloud API.
10+
keywords:
11+
- OCR
12+
- identify
13+
- queue
14+
- send
15+
- font
16+
- style
17+
- bold
18+
- italic
19+
- typeface
20+
- detect
21+
---
22+
23+
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](/ocr/authorization/) in **Authorization** header (_Bearer authentication_).
24+
25+
The image and font detection parameters are provided in JSON format in the request body.
26+
27+
```json
28+
{
29+
"image": "Base64 string",
30+
"settings": {
31+
"language": "English",
32+
"makeSkewCorrect": true,
33+
"rotate": 0,
34+
"makeBinarization": false,
35+
"makeContrastCorrection": true,
36+
"makeUpsampling": false,
37+
"resultType": "Text"
38+
}
39+
}
40+
```
41+
42+
## Providing an image
43+
44+
Photo or scan is provided in a value of `image` property as a Base64 encoded string.
45+
46+
{{% alert color="caution" %}}
47+
Base64 encoded file can be very long, especially when analyzing scans and high resolution photos. As a result, you may encounter an error when calling font identification via cURL in a shell command. Use the `getconf ARG_MAX` command to check the maximum length of the command arguments (in bytes).
48+
{{% /alert %}}
49+
50+
## Font identification settings
51+
52+
Property | Type | Default&nbsp;value | Description
53+
------- | ---- | ------------- | -----------
54+
`language` | string | `English` | Specify a [language](/ocr/supported-languages/) for font identification.
55+
`makeSkewCorrect` | boolean | `true` | Automatically correct image tilt (deskew) before proceeding to font identification.<br />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.
56+
`rotate` | integer | `0` | Rotate an image by the specified degree.<br />Should be used when the image is rotated by a significant angle or turned upside down.
57+
`makeBinarization` | boolean | `false` | Automatically convert an image to black and white before proceeding to font identification.
58+
`makeContrastCorrection` | boolean | `true` | Automatically [increase the contrast](/ocr/correct-image-contrast/) of an image before proceeding to font identification.
59+
`makeUpsampling` | boolean | `false` | Intellectually upscale an image to improve small font detection, for example in food labels.
60+
`resultType` | string | `Text` | The result of font identification is always returned as a JSON string, so the value of this parameter must be `Text`.
61+
62+
## Image preprocessing order
63+
64+
If image preprocessing filters are enabled, they are applied one after the other in the following order:
65+
66+
1. [Contrast correction](/ocr/correct-image-contrast/) (`"makeContrastCorrection": true`)
67+
2. [Skew correction](/ocr/deskew-image/#using-the-recognition-setting) (`"makeSkewCorrect": true`)
68+
3. [Upsampling](/ocr/upsample-image/#using-the-recognition-setting) (`"makeUpsampling": true`)
69+
70+
If you want to apply preprocessing filters in another order, disable the corresponding font identification settings and use [self-managed preprocessing](/ocr/preprocess-image/).
71+
72+
## Return value
73+
74+
If successful, this method returns a string with a unique identifier (GUID) of the font identification request in the [queue](/ocr/recognition-workflow/).
75+
76+
Otherwise, it returns a HTTP status code corresponding to the error.
77+
78+
## What's next
79+
80+
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](/ocr/fetch-font-identification-result/) for information on how to get a font identification result from the server.
81+
82+
## cURL example
83+
84+
{{< tabs tabID="1" tabTotal="2" tabName1="Request" tabName2="Response" >}}
85+
{{< tab tabNum="1" >}}
86+
```bash
87+
curl --location --request POST 'https://api.aspose.cloud/v5.0/ocr/IdentifyFont' \
88+
--header 'Accept: text/plain' \
89+
--header 'Content-Type: application/json' \
90+
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...HaRYOxBcCRCPLnrFCVXpw7UA' \
91+
--data-raw '{
92+
"image": "/9j/4AAQSkZJRgABAgAAZABkAAD...8AkTf/2Q==",
93+
"settings": {
94+
"makeSkewCorrect": true,
95+
"resultType": "Text"
96+
}
97+
}'
98+
```
99+
{{< /tab >}}
100+
{{< tab tabNum="2" >}}
101+
```
102+
c11c975d-5124-4555-9561-af40fb95ba07
103+
```
104+
{{< /tab >}}
105+
{{< /tabs >}}

0 commit comments

Comments
 (0)