144

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

4

11 Answers 11

102

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.

12
  • 16
    No more overkill than the 5 or so 'free' programs I installed that left a watermark on the image. Worked beautifully, thanks!
    – Raymond
    Sep 8, 2010 at 1:00
  • 1
    This is exactly what I needed. I wanted to convert a PDF to a high-resolution PNG file, and using GIMP worked really great!
    – Mas
    Sep 6, 2011 at 19:27
  • 1
    Thanks, have tried several tools, either with watermarks or other limitations. GIMP works fine. Oct 22, 2011 at 0:08
  • 10
    Gimp works great for a single page, but I don't see a simple way to export lots of pages automatically. I'm sure if you know gimp well you could use automation tools to get it working. But perhaps pdftoppm is better. Mar 5, 2013 at 23:07
  • @chrishiestand, You should post that as an alternative answer.
    – Brad
    Mar 6, 2013 at 0:21
171

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

10
  • 7
    on mac with homebrew I had to install imagemagick and ghostscript for this to work. brew install imagemagick brew install ghostscript
    – Andreas
    Feb 20, 2012 at 16:01
  • 20
    +1 for pdftoppm: good results and fast. Oct 24, 2012 at 12:42
  • 3
    Why do you prefer the results of pdftoppm? I notice that the default output resolution is higher than imagemagick (although this can be changed), but apart from that they seem comparable on my test file.
    – Sparhawk
    Feb 14, 2013 at 4:22
  • 4
    converting multipage PDF with poppler will look more like this: pdftoppm -png myfile.pdf myfile Jul 23, 2013 at 15:30
  • 4
    See blog.alivate.com.au/poppler-windows for windows binaries of poppler and use pdftocairo -png
    – kromuchi
    Jan 9, 2014 at 11:51
19

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.

1
  • On macOS you can also use the build-in sips tool: sips -s format png the_pdf_file.pdf --out the_png_file.png
    – goetz
    Apr 29, 2019 at 0:13
12

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.

1
  • 3
    Signed up for super user just to upvote this. Now if I only had any hope of remembering it...
    – joeA
    Oct 10, 2014 at 2:47
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).

3
  • 1
    +1 for inkscape. Because you can edit the pages, rework the diagrams and save as svg or even as pdf etc... Oct 22, 2015 at 13:31
  • I think -e should be -o, no? Dec 1, 2023 at 9:36
  • No, -e is correct. It is short for --export-png. There is no -o according to the manpage. Thanks for pointing that out; I edited the answer accordingly.
    – Scz
    Dec 8, 2023 at 14:47
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.

5

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

alt text

1
3

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

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

7
  • 1
    Paint can open PDFs?
    – Daniel Beck
    Jun 4, 2013 at 17:59
  • @DanielBeck He's saying to open in a PDF viewer, then copy and paste Jun 4, 2013 at 18:01
  • @CanadianLuke what PDF viewer allows you to do that? The default one on Windows 10 and 11 definitely doesn't. Nov 5, 2023 at 1:12
  • @gargoylebident Try taking a screenshot of random PDFs Nov 8, 2023 at 23:43
  • @CanadianLuke and what would that achieve? Nov 11, 2023 at 0:19
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.

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .