0

I have a few hundred image files. This consist of files of multiple type like 1.png 2.jpg 3.png and so on. I want to create a PDF from these images without changing the order of pages. The number in the image name must be used to preserve the order of pages.

Sunny
  • 103

2 Answers2

2

You could create a bash script:

#!/bin/bash

for f in *.jpg; do
  convert ./"$f" ./"${f%.jpg}.pdf"
done

EDIT: Source - https://unix.stackexchange.com/questions/29869/converting-multiple-image-files-from-jpeg-to-pdf-format

2

Using imagemagick, you could use a script like that

TMP=`mktemp -d`
for img in `ls`; do
    convert "$img" "$TMP"/"$img".pdf
done

convert $TMP/*.pdf merged.pdf

EDIT: I saw now a similar response. The only thing that this script adds is merging all the files in only one pdf.

clobrano
  • 287