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.
Asked
Active
Viewed 238 times
2 Answers
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

SlidingHorn
- 106
-
OP said that there are multiple extensions like jpg and png, not only one. And you could just write that command in one line instead of creating a script file for it. – Byte Commander Nov 20 '15 at 11:28
-
I missed that...I'll have to pay closer attention, apparently – SlidingHorn Nov 20 '15 at 11:29
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
-
Actually I used pdfunite at the last line as convert is blurring the images – Sunny Nov 20 '15 at 12:19