ImageMagick: how to batch combine multiple TIFF file to a single TIFF file in a directory?

我只是一个虾纸丫 提交于 2019-12-01 21:10:27

Assuming you want to combine the 600 single-page TIFFs into one single multi-page TIFF (per set of 3), it is as simple as:

 convert  001_*.tiff  1_merged.tiff
 convert  002_*.tiff  2_merged.tiff
 [....]
 convert  200_*.tiff  200_merged.tiff

Please note that nobody will be able to guarantee any timing/performance benchmarks... least while we don't even have any idea how exactly your input TIFFs are constituted. (Are they 10000x10000 pixels or are they 20x20 pixels?, Are they color or grayscale?, etc.pp.)

This is different from Mark's answer, because he seems to have assumed you want to combine the input files all into a 1-page image, where the originals are tiled across a larger page...

This should do it - I will leave you to do error checking in case you haven't actually got all the images you suggest!

@ECHO OFF
setlocal EnableDelayedExpansion
FOR /L %%A IN (1,1,200) DO (
   set "formattedValue=000000%%A"
   set "x=!formattedValue:~-3!"
   convert !x!_*.tif +append !x!_merged.tif
   echo !x!
)

So, if your images look like this

001_1.tif

001_2.tif

001_3.tif

you will get this in merged_001.tif

If you change +append to -append then merged_001.tif will be like this:

If you remove +append altogether, you will get 200 multi-page TIFs with 3 pages each - same as Kurt's answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!