- Please see Format your code to make it more readable
- The way you used
$index
makesmontage
only use it as a target, meaning you did not specify the source files, somontage
uses all the files it finds as source and explodes when you run out of RAM. Instead, if you refer to the ridiculously long documentation I linked to in my previous post, you should specify the source files first, and the target file last. So change:
for index in $(seq 1 2 10); do
montage -adjoin -quality 100 -background none -geometry +0+0 $index.jpg
done
to
for i in {1..100..2}; do
montage -quality 92 -background white -tile 2x1 -geometry +0+0 "${i}.jpg" "$((i+1)).jpg" "output_${i}-$((i+1)).jpg"
done
To help you understand the code: