Convert Images to PDF
Converting sets of images into multi-page PDF files makes it easier to organize and share them. All you need for the conversion is the free ImageMagick that will run on your Windows, Linux, MacOS and many other operating systems. If you are running a recent version of Linux, chances are that ImageMagick is already installed on your computer (just type “which convert” to check).
The basic syntax for the conversion is very simple:
convert *.jpg filename.pdfThis command will look for all *.jpg files in the current directory and it will add them to a single PDF file.
In the following example we have a bunch of folders in /home/user/photos. Each folder contains many JPEG files. You want to convert each folder of these images into a PDF file with the same name as the folder:
ls | fgrep -v . | while read FOLDER do nice -n +10 convert ./${FOLDER}/*.jpg ./${FOLDER}.pdf done
Unfortunately, when performing batch file conversions, ImageMagick uses lots of RAM and CPU. To keep ImageMagick from taking over your CPU, we use the “nice” command. The more images you have in a folder, the more RAM/swap ImageMagick will use. It is possible that your system may run out of swap space. To add extra swap space on the fly, do the following:
dd if=/dev/zero of=/swapfile bs=1024 count=65536 mkswap /swapfile swapon /swapfile
Running “top” or “free” will show you how much swap space your system has. It is advisable to put the extra swap space on a secondary disk, so not to slow down the system disk with swap I/O. ImageMagick is a bit sluggish and resource-hungry when it comes to working with PDF files. Adobe Acrobat is much faster and more efficient. But then again, ImageMagick doesn’t cost you three hundred bucks and it produces fully-compatible PDF files.
Popularity: 7% [?]
Related posts:


