TIFF (Tagged Image File Format) is a popular format for storing high-quality digital images. It is also famous because it can store much more image data than its JPEG counterpart, and provides stunning image quality. Predominantly, lossless compression means TIFF files retain the original image’s detail and color depth — perfect for high-quality professional photos. With Aspose.PDF Cloud, it is possible to combine multiple TIFF images into a single TIFF file, which can be useful for several applications. This article will guide you through the process of combining TIFF images using Aspose.PDF Cloud API in Java.
Image Processing API
Aspose.Imaging Cloud is a cloud-based API for working with images, including TIFF images. It provides an easy-to-use interface for and offers a number of features for working with TIFF images, including the ability to combine multiple TIFF files into a single TIFF file. Using Aspose.Imaging Cloud SDK for Java, developers can simplify the process of combining TIFF images, as they can perform this task entirely in the cloud, without having to install any software locally. Now, in order to use its capabilities in Java project, we need to add its reference in java project by including the following information in pom.xml (maven build type project).
<repositories> <repository> <id>aspose-cloud</id> <name>artifact.aspose-cloud-releases</name> <url>http://artifact.aspose.cloud/repo</url> </repository> </repositories> <dependencies> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-imaging-cloud</artifactId> <version>22.4</version> </dependency> </dependencies>
Once the SDK references have been added, please obtain your personalized client credentials from Cloud Dashboard. In case you do not have an account, please create a free account using a valid email address.
Combine TIFF Images in Java
This section is going to shed light on steps to append TIFF files using Java.
- Firstly, create an object of ImagingApi, while passing your personalized client credentials as arguments
- Secondly, read the content of first TIFF image using readAllBytes(…) method and return it to byte array
- Thirdly, create an instance of UploadFileRequest class, where we specify the name for TIFF image to be uploaded on Cloud storage
- Now upload the first TIFF image to cloud storage using uploadFile(…) method
- Repeat the same steps to read and then upload the second TIFF image to Cloud storage
- Now we need to create an object of AppendTiffRequest where we specify the names of TIFF images to be merged
- Initiate the TIFF merge operation using appendTiff(…) method of ImagingAPI
- As the resultant image is stored in Cloud storage, so we need to use the DownloadFileRequest object, to download the combined TIFF image
The sample TIFF images used in the above example can be downloaded from DeskewSampleImage.tif and second.tiff. The final merge TIFF can also be downloaded from Merged-TIFF.tiff.
Append TIF Files using cURL Commands
As our SDKs are built according to REST architecture, which supports platform independent capabilities, so we can easily access them via command line terminal. Now this section, is going to explain the details on how to merge TIFF files using cURL commands.
The first step is to generate a JWT access token (based on client credentials) using the following command.
curl -v "https://api.aspose.cloud/connect/token" \ -X POST \ -d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept: application/json"
Once the JWT token has been generated, we need to execute the following command to merge the TIFF images.
curl -v -X POST "https://api.aspose.cloud/v3.0/imaging/tiff/first.tiff/appendTiff?appendFile=second.tiff" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>" \ -o Combined.tiff
In conclusion, combining TIFF images is a straightforward task that can be easily accomplished using the Aspose.Imaging Cloud SDK for Java. With its cloud-based architecture and comprehensive set of features, Aspose.Imaging Cloud provides a convenient and efficient way to perform image manipulation tasks, including combining TIFF images, without having to worry about managing complex image processing libraries or installation procedures. Whether you’re a professional software developer or just need to perform a simple image manipulation task, Aspose.Imaging Cloud provides a reliable and easy-to-use solution for all your image processing needs.
We highly recommend exploring the Product Documentation, which contains a plethora of information and enables you to learn other exciting features of the API. Lastly, in case you encounter any issues while using the API, you may consider approaching us for a quick resolution via the free product support forum.
Please visit the following links to learn more about: