I have a folder with 100 jpg images. I want to convert these images into a multi-page pdf file, with all the images (cropped to A4 size). They are already in the correct rotation.

Which tools should I use?




Type the follow line to commmand prompt for intall ImageMagick:

sudo apt-get install imagemagick

Convert from jpegs to PDF:

Go to the work directory (directory of jpegs):

cd work/directory/path

Convert the JPG files to PDF:

convert *.jpg foo.pdf

source : http://bitprison.net/jpg_to_pdf

  • I found the solution myself, but you answered with more details. This was so simple I'm even ashamed of. – Somebody still uses you MS-DOS Aug 4 '11 at 15:13
  • ^you r welcome! – mr_eclair Aug 4 '11 at 15:14
  • Hmm, does not yet crop to A4 aspect ratio though ;) – tanius Aug 4 '15 at 11:32
  • If you have the images in sub folders use this convert */*.jpg foo.pdf – Phil Roggenbuck May 15 '18 at 9:05
  • I still have a problem he sorts everything like 1, 10, 100 and not 1,2,3,4,5,...,100,101,102 how do I fix this? – Phil Roggenbuck May 15 '18 at 10:27

Unfortunately convert changes the image before so to have minimal loss of quality, i.e. the quality of the original jpg, you need to use img2pdf, I use this commands:

3 1) This to make a pdf file out of every jpg image without loss of either resolution or quality:

ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf

2) This to concatenate the pdfpages into one:

pdftk *.pdf cat output combined.pdf

3) And last I add an OCRed text layer that doesn't change the quality of the scan in the pdfs so they can be searchable:

pypdfocr combined.pdf  

I highly recommend the Python CLI program img2pdf for lossless conversion:


Example usage:

img2pdf img1.png img2.jpg -o out.pdf

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.