This short tutorial guides on how to deskew scanned documents using C# REST API. You will learn to automatically straighten scanned image using C# Low Code API with the help of a .NET-based Cloud SDK. It contains all the steps from loading the source image from the local file system to process and download the output from the Cloud.
Prerequisite
- Create an account API credentials to deskew an image
- Download Aspose.Imaging Cloud SDK for Dotnet for correcting the image orientation
- Setup C# project with the above SDK
Steps to Straighten Scanned Image using C# Low Code API
- Commence the process by providing your Aspose Cloud credentials and the API base URL to authenticate and initialize the SDK client using ImagingApi
- Specify the filename of the skewed image and load it into a memory stream from the local system
- Upload the image to the cloud storage so Aspose API can access it
- Define options for deskewing
- Create a DeskewImageRequest with the uploaded filename and the above parameters and call DeskewImage()
- Save the deskewed image returned by the API to a local file
These steps have summarized the process to deskew photo using C# Low Code API. Commence the process by initializing the API client, uploading the skewed image, and creating the DeskewImageRequest object by filling in the required information. Subsequently, call the DeskewImage() method to straighten the image and save the response stream on the local file system as an image.
Code to Deskew Image Online using C# REST Interface
This code has demonstrated how to deskew photo using C# RESTful Service. We have set resizeProportionally as true to keep the image image’s aspect ratio after deskewing whereas seeing to false will result into stretching that may distort the image. Note that instead of writing the background color name, you may use the color code such as #FFFFFF.
This article has taught us the process to deskew an image. To convert a colored image to black and white, refer to the article on Convert Color Image to Black and White using C# REST API.