How to merge TIFF images using java

TIFF Merger Java API

GroupDocs.Merger allows developers to combine multiple TIFF documents in the preferred order and save them as a single file.

About TIFF File Format

TIFF, Tag Image File Format, is a computer file used to store raster graphics and image information. A favorite among photographers, TIFFs are a handy way to store high-quality images before editing if you want to avoid lossy file formats.

Download and Configure

You can follow the steps below to reference GroupDocs.Merger for Java downloaded from official website Downloads section:

  1. Unpack zip archive .
  2. Switch to lib folder.
  3. Run install.bat (for Windows) or install.sh (for Linux) file to install the library in your local maven repository.
  4. After this you should add the merger dependency block to your pom.xml project file.

Source TIFF images

“Sample1.tiff” “Sample2.tiff” “Sample3.tiff”

How to merge TIFF files in vertical mode

The following example demonstrates how to merge image files in vertical mode with several lines of java code:

  • Create an instance of Merger class and pass source image file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Create an instance of ImageJoinOptions class and pass enum value of ImageJoinMode as a constructor parameter.
  • Add another image file to merge with Join method and pass instance of ImageJoinOptions class as a method parameter. Repeat this step for other image documents you want to merge.
  • Call Merger class Save method and specify the filename for the merged image file as parameter.
// Load the source image file
Merger merger = new Merger("c:\sample1.tiff")

// Define image join options with vertical join mode
ImageJoinOptions joinOptions = new ImageJoinOptions(ImageJoinMode.Vertical);
// Add another image file to merge
merger.join("c:\sample2.tiff", joinOptions);
// Add next image file to merge
merger.join("c:\sample3.tiff", joinOptions);
// Merge image files and save result
merger.save("c:\merged.tiff");

Result merged TIFF image

“Merged.tiff”

Code Examples

Please find more use-cases and complete java sources of our backend and frontend examples and try them for free!

Merge TIFF Live Demo

GroupDocs.Merger for Java provides an online TIFF Merger App, which allows you to try it for free and check its quality and accuracy.