Crop Image with C# REST API

This short tutorial guides on how to crop image online with C# REST API. You will learn to crop picture online with C# Low Code API using a .NET-based Cloud SDK. It will introduce you to define the cropping parameters and save the output image in any format as per the requirements.

Prerequisite

Steps to Crop a JPEG with C# Low Code API

  1. Define the base URI, Client ID, and Client Secret to initialize the ImagingApi object
  2. Define the input image, read it into the memory stream and upload it to the Cloud storage for further processing
  3. Define the cropping parameters and prepare the crop image request
  4. Perform the cropping operation using the CropImage() method
  5. Retrieve the resultant cropped image and save it on the disk

These steps summarize the process to crop picture with C# RESTful Service. Define the credentials, create the ImagingApi and an upload request, and upload the image file to the Cloud storage. Finally, define the cropping parameters, create the crop image request, and crop the image using the defined request.

Code for Photo Cropping Tool with C# .NET-based API

This code has demonstrated the process to crop photo online with C# .NET-based API. We have used the output format as JPG. However, you may set any other format as per your requirements. You can select any portion of the uploaded picture by setting the appropriate parameters.

This article has taught us how to cut an image out of a picture with C# REST API. To resize an image, refer to the article on Change Size of the Image with C# REST API.

 English