Merge JPEG images online. Free API to merge Images in C#

Merge images online

The raster image formats (JPEG, PNG, GIF, PNG, etc) are the popular formats for picture data sharing. Most imaging devices including modern digital cameras and mobile phones directly produce the output in one of these formats. Each image is separately saved and for information sharing perspective, it’s shared among the users. However, we may have a requirement to share multiple images together or combine the related images and share them as a single raster image. For this purpose, commercial softwares are available but they incur installation and licensing cost.

So if your only requirement is to merge the Image files, then why spend so much time on software configurations and pay the extra cost of whole licensing for one single operation. Also, the majority of applications are available for desktop systems, and in case you need to perform the operations on mobile devices, it gets quite complicated. Therefore, in order to develop a platform-independent solution that shall provide a consistent user experience, a Cloud REST API is a viable approach. In this article, we are further going to discuss the details on how to merge JPEG images.

Image processing API

Aspose offers a plethora of document processing APIs and Aspose.PDF Cloud is one of the leading APIs providing the capabilities to create as well as manipulate PDF documents. In order to facilitate programmers using C# .NET, we have created Aspose.PDF Cloud SDK for .NET that is a wrapper around Cloud API. In order to use the SDK, the first step is to install it over system. The SDK is available on NuGet and GitHub.

Please execute the following command on terminal to install the SDK from NuGet

Install-Package Aspose.Pdf-Cloud

You may consider visiting following link for further details on How to install Aspose.Cloud SDKs.

However, before proceeding further, the first step is to create an account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Merge images in C#

Aspose.PDF Cloud provides the capabilities to Create Empty PDF, Add a new Image to a PDF Document, and Converting Document Pages to Image Format. So in order to accomplish our requirement of merging the images, please follow the instructions given below

  • First of all, create an object of PdfApi while passing ClientID and ClientSecret details are arguments
  • Secondly, call the PutCreateDocument(…) method of PdfApi class to create an empty PDF document
  • Now call PostInsertImage(..) method which takes input PDF filename, PageNumber, XY coordinates, and image file name as arguments
  • Repeat the method to add more images
  • Finally, call the PutPageConvertToJpeg(…) method to convert PDF file to JPEG image and store the output in cloud storage

Combine images using the cURL command

The cURL commands are an exciting and convenient way to access the REST APIs via command prompt on any platform and they provide the same consistent experience. So we can achieve the same image merger functionality via cURL commands.

In order to use the cURL commands, the first step is to generate a JWT access token. Use the following command to generate a required token. For more information, please visit How to Obtain JWT token using a Client ID and Client Secret key.

curl -v "" \
-d "grant_type=client_credentials&client_id=718e4235-8866-4ebe-bff4-f5a14a4b6466&client_secret=388e864b819d8b067a8b1cb625a2ea8e" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

The next step is to create a blank PDF document.

curl -X PUT "" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"
curl -X POST "" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"image":{}}

Repeat the same step to insert other images with different coordinates. Finally, convert the PDF file to Image format using the following command.

curl -X PUT "" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \

The sample PDF and resultant image generated are attached below.


This article has explained the steps and related details on how to merge JPEG raster images to a single combined image. The whole process can be completed using Aspose.PDF Cloud SDK for .NET. Apart from the above-mentioned features, the API is capable of performing other amazing features. For more information, please visit Aspose.PDF Cloud Features and Overview.

In case you encounter any issues while using the API, please feel free to contact the Free product support forum. We also recommend visiting following blogs for information on