public static void merge ( List < File > inputFiles , File outputFile ) throws IOException { ImageOutputStream output = null ; try { output = ImageIO . createImageOutputStream ( outputFile ) ; for ( File file : inputFiles ) { ImageInputStream input = null ; try { input = ImageIO . createImageInputStream ( file ) ; List < TIFFPage > pages = getPages ( input ) ; writePages ( output , pages ) ; } finally { if ( input != null ) { input . close ( ) ; } } } } finally { if ( output != null ) { output . flush ( ) ; output . close ( ) ; } } }
Merges all pages from the input TIFF files into one TIFF file at the output location .