166

Is there a free way to convert a PDF document to a PNG image?

George
  • 282
Raymond
  • 2,850

11 Answers11

193

Personally I prefer the results obtained from pdftoppm from Poppler utilities:

pdftoppm -png myfile.pdf > myfile.png

If you have ImageMagick installed, you can just type:

convert myfile.pdf myfile.png

Note: To use ImageMagick, you may also need Ghostscript.

Note: On Windows, convert is a system program, so you'd need to run the ImageMagick convert binary by using it's full path.


To install Poppler from the command line (provides the pdftoppm command)...

On Windows, you can use Chocolatey:

choco install poppler

On Mac, you can use Homebrew:

brew install poppler

frabjous
  • 11,333
115

This is overkill for what you need, but in the absence of another answer, GIMP can do this for you. Just install it, open the PDF, and save-as a PNG.

Brad
  • 6,629
20

Windows: Install PDFCreator and open your PDF. Print it to the PDFCreator printer (or whatever you called it) and hit save. When you hit save, after choosing a filename, set the filetype to PNG.

Linux: Install ImageMagick (on Ubuntu: sudo apt-get install imagemagick) and then in a terminal type: convert [Input PDF File.pdf] [Output PNG File.png].

Mac OS X: Open the PDF in Preview and in the Save As dialog, set the filetype to png.

digitxp
  • 14,884
13

You could also use GS:

"c:\Program Files\gs\gs9.10\bin\gswin64.exe" -dBATCH -dNOPAUSE -sDEVICE=pnggray -r300 -dUseCropBox -sOutputFile="path_to_png_files\pdffilename-%03d.png" "path_to_pdf_file\pdffilename.pdf"

The path to GS should be adjusted based on your installation.

The DEVICE parameter here will specify grayscale. You can also output with color instead. These settings will allow you to output to 24-bit color, 300 dpi PNG files using the RGB.icc color profile:

-sDEVICE=png16m -sOutputICCProfile=default_rgb.icc -r300

Compared to convert, GS seems to run much faster, and it is more suitable for big batches of conversion.

Ben Richards
  • 12,917
imriss
  • 387
9

Another way is

inkscape -d 300 -e "$filename.png" "$filename.pdf"

with -e short for --export-png and -d short for --export-dpi (you can omit -d 300 if you only need 96 dpi).

However, inkscape may have problems with the fonts, which is why I prefer convert from ImageMagick (see frabjous' and digitxp's answers).

Scz
  • 463
6

Which OS do you use?

On a Mac, it's as simple as opening the PDF in the Preview app and saving it as a PNG.

On http://www.zamzar.com/, you can convert many file types for free also.

jsejcksn
  • 4,581
5

If using Windows, I would use Bullzip PDF Printer, simply choose print and then select .PNG as the file type.

alt text

William Hilsum
  • 117,648
4

Use VIPS.

vips copy filename.pdf[page=33,dpi=400] filename.png

The parameters in square brackets are explained in the docs:

  • page : gint, load this page, numbered from zero
  • n : gint, load this many pages
  • dpi : gdouble, render at this DPI
  • scale : gdouble, scale render by this factor
  • background : VipsArrayDouble background colour
  • password : gchararray background colour
3

The docupub online tool works quite well, you get an image per page: http://docupub.com/pdfconvert/

fabb
  • 174
  • 8
2

if you don't don't feel like downloading anything just copy the picture and paste in paint then save as PNG and there you have it. no watermarks, not downloading files.. simple

1

This free online tool:

convert.town/pdf-to-png

will convert a PDF file to a PNG image inside your browser. You won't need to install anything.

If the PDF is multi-page, it will create a new image for each page.

sunset
  • 319