I'm trying to find a way to batch combine multiple pairs of images into a single image. I have a folder of hundreds of photos -- img01, img02,... -- and I'm trying to merge pairs of these into 1: img01 + img02 --> img01_02
img 519 + img 520 --> img519_520
The images all have the same dimensions.
I have seen a couple of threads that are pretty similar and have tried the code below, but these only work for the first 6-10 images and I need to be able to loop the commands over hundreds of photos.
Code: Select all
arr=(`ls *.jpg`)
num=${#arr[*]}
for ((i=0; i<num; i=i+2)); do
j=$((i+1))
k=$((i+2))
convert ${arr[$i]} ${arr[$j]} +append newimage_${j}_${k}.jpg
done
I'm using a Mac OS High Sierra 10.13.4 and my imagemagick is version 6.9.1-0 Q16 x86_64 2015-03-22. I am running the commands on terminal.
Any help would be really appreciated. Thanks a lot in advance!
Similar threads I've seen:
viewtopic.php?t=32333
https://imagemagick.org/discourse-serve ... hp?t=24302