Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Applications

Convert Images to PDF

Submitted by on July 18, 2008 – 12:26 am 4 Comments

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.pdf

This command will look for all *.jpg files in the current directory and it will add them to a single PDF file using the adobe editor.

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.

Print Friendly, PDF & Email

4 Comments »

  • tjpimpin says:

    Does anybody knows how to convert a pdf say with line charts to a powerpoint format. I know how to cut and copy paste but I have seen in presentations that people can somehow import it and it looks like you have created the chart just by putting data in excel and created a graph. does not have that PDF look.

    I hope I am able to clarify what I am looking for

  • diggn4richez says:

    I need to convert 6000 PDF document to DOC. I’ve looked at many tools on the net, it seems all of them can only convert 1 file at a time. Is there anyway to select multiple files and convert them all?
    I don’t mind softwares where you have to pay.

  • The Villain says:

    I have a pdf image file that I want to upload to facebook but I can only upload jpg files to facebook. That’s why I need to convert image file from pdf to jpg.

  • The Dark Knight says:

    I have a ppt file that has screen shots of a PPT presentation that was on WebEx. Is there some kind of free ereader/converter that can take the images of the PPT slides and convert them so that they can be editable ppt slides in Powerpoint?

Leave a Reply

%d bloggers like this: