create your own

Convert a PDF File To JPEG

69
rate or flag this page

By amaclane


The PDF format is a vector graphics format often used for page layout and illustrations. Although there are many programs for viewing PDF files, editing or converting them is a little bit harder. Since JPEG is a raster format, a program needs to render the PDF and then rasterize it. Here I'll show you one way to convert an entire PDF file or just a few pages to a JPEG image.

Using ImageMagick

ImageMagick is a set of tools for creating, editing, and converting many different graphics format. ImageMagick can do a few things with PDF files, too, and in particular it can convert them to raster formats. ImageMagick is a command line tool, so you'll need to be comfortable using the command prompt. First, install ImageMagick, following the instructions on their website. To convert a PDF to JPEG, we'll use the ImageMagick "convert" command. As its name says, this program can convert from one format to another. It can also do lots of other things, like scaling the output to a particular size. This can be useful for things like making thumbnails. To convert an entire PDF to a bunch of JPEGs, run the command

convert input.pdf output.jpg

This will convert the input file "input.pdf" to a series of JPEG files, "output-1.jpg", "output-2.jpg", and so on, one for each page of the input file. If you want to convert just one page of a document, you can use square brackets like this:

convert input.pdf[3] page3.jpg

This will convert the third page of "input.pdf" to a JPEG file named "page3.jpg". (Note that ImageMagick starts numbering from zero, not one!) If you want to do something more, you can add ImageMagick options like "-scale" or "-crop". For example, to make a thumbnail of the first page of a PDF that is 25% the size of the real thing, run the command

convert input.pdf[0] -scale 25% thumbnail.jpg

ImageMagick is a pretty powerful program, and it can do things like scale an image to be a certain width or height, preserving aspect ratio. For example, if we want a thumbnail of the first page of a PDF which is 100 pixels wide, we can run

convert input.pdf[0] -resize x100 thumbnail2.jpg

Similarly,

convert input.pdf[0] -resize 100x thumbnail2.jpg

creates a file that is 100 pixels in height, preserving the aspect ratio of the original image.

ImageMagick is a powerful program. Here are some more examples of using it to convert and edit pictures. You might also want to know more about converting TIFF files to JPEG.  Happy converting!

Print   —   Rate it:  up  down  flag this hub

RSS for comments on this Hub

No comments yet.

Submit a Comment

Members and Guests

Sign in or sign up and post using a hubpages account.


optional


  • No HTML is allowed in comments, but URLs will be hyperlinked
  • Comments are not for promoting your hubs or other sites

working