It's known that images can be converted to one single pdf with the following command (assuming images filenames are order correctly):
convert *.jpg output.pdf.
However, this approach may take too much RAM when it involves thousands images. Another idea would be converting images to pdf by batches, then concatenate the resulted pdf to a single one with
pdftk output-*.pdf cat output output.pdf
So far, I tried to batch convert images with
ls *.jpg | xargs -d $'\n' -t -n 100 bash -c 'convert "$@" output.pdf'
It works well except that each time,
convert erases the previous pdf.
Question: Is there a way to count the batch number, and produce successively, for instance,