Merge JPG images online using C# REST API

A quick and easy implementation to merge JPG images. Combine JPG to PDF or other supported formats.

Merge JPG
Merge JPG Images | JPG Merge capabilities in .NET Application

The raster image formats (JPG, 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 from an information-sharing perspective, it’s shared among the users. However, we may have a requirement to share multiple images together or combine the relasted images and share them as a single raster image. For this purpose, commercial software’s are available but they incur installation and licensing costs.

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 of how to merge JPG images.

Info: Aspose recently developed a Collage app that allows you to merge JPG images or combine photos online on a grid.

PDF 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 which is a wrapper around Cloud API. In order to use the SDK, the first step is to install it over the system. The SDK is available on NuGet and GitHub.

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

Install-Package Aspose.Pdf-Cloud

You may consider visiting the 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 JPG 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 merge JPG online, 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 files to JPEG images and save the output in cloud storage

Combine JPG using 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 JPEG merge 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 JPG images. The whole process can be completed using Aspose.PDF Cloud SDK for .NET. Apart from the above-mentioned features, the API is also capable of performing other amazing features and their details can be found in Aspose.PDF Cloud Features and Overview sections.

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