In the recent past, we have published a blog post that demonstrates the conversion process of image to text with OCR in C#. In this blog post, we will learn how to convert Image to JSON using C# programmatically. We will use an enterprise-level .NET OCR API that offers methods and properties to configure the API calls that make image to JSON conversion efficient. This library also provides the methods to extract the text from a particular area of the image.
The following sections will be covered in this article:
- .NET OCR API installation
- How to convert Image to JSON using C#
- Image to JSON conversion API - advanced options
.NET OCR API installation
The installation procedure is simple, and you can install it without any third-party dependency. So, you can either download the DLL files or run the following command in the NuGet package manager to install this .NET OCR API.
How to convert Image to JSON using C#
This OCR library is able to recognize the scanned mages, screenshots, or any other image format. It lets you convert PDFs and images to text and JSON format.
Let’s write the following steps and the code snippet to convert image to JSON in a .NET application:
- Get the image URL.
- Initialize an instance of AsposeOcr.
- Create an object of RecognitionResult class and initialize it with the image recognition result.
- Instantiate an instance of RecognitionSettings class to customize the recognition process.
- Initialize the RecognizeImageFromUri method that recognizes text on image provided by the URI link.
- Call the RecognitionText method to get the recognition result in one string.
- Invoke the GetJson method to form JSON string with recognition results.
You can see the output in the image below:
Image to JSON conversion API - advanced options
This .NET OCR API offers more than format conversion and processing options. There are many cases where you need to apply pre-processing provisions on the images for which this API provides methods and classes that you may find here.
Get a Free License
You may get a free temporary license to try the API beyond evaluation limitations.
We are ending this blog post here with the hope that you have learned how to convert image to JSON in C# programmatically. Furthermore, you may visit the documentation of this .NET OCR API to know about other features. Feel free to visit the GitHub repo to see the code examples with the descriptions. Finally, conholdate.com is writing new blog posts on new topics. Therefore, please stay in touch for regular updates.
Ask a question
You can let us know about your questions or queries on our forum.
Can we send image in JSON?
How do you put an image file in a JSON object?