How to convert a PDF document to PNG?

101

33

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

Raymond

Posted 2010-09-08T00:34:40.340

Reputation: 2 101

Open in Photoshop and save as PNG – user956584 – 2016-10-20T20:35:04.197

1

I asked a similar question last year on Stack Overflow. You can read the answers there.

– stevenvh – 2010-09-08T07:13:43.453

Answers

82

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

Posted 2010-09-08T00:34:40.340

Reputation: 4 459

Route is "import" -> export as – Rachael – 2015-10-27T18:10:00.237

While this is an old post, I think it may be worth pointing out that GIMP is not an ideal solution - at least I remember it not readin a pdf file generated by R correctly. Using pfftoppm with R generated pdf plots produces the correct image. (And Adobe Acrobat 9 Pro works too if you have it - can't speak about other versions.) – DetlevCM – 2016-03-13T14:28:24.740

Just don't make the mistake of trying to actually edit the PNG with GIMP if you know how to use any other image editor. Convert and export. – Noumenon – 2016-10-13T11:23:57.717

For multi page pdfs you can File>Open_as_layers then File>Export_Layers using the export layers as png plugin

– Mr Purple – 2017-05-01T21:10:56.213

An update may be in order. With the 2.8.16 version of GIMP, I found that "Export as" is used instead of "Save as". – GreenMatt – 2017-09-13T20:46:40.303

9No more overkill than the 5 or so 'free' programs I installed that left a watermark on the image. Worked beautifully, thanks! – Raymond – 2010-09-08T01:00:54.050

1This is exactly what I needed. I wanted to convert a PDF to a high-resolution PNG file, and using GIMP worked really great! – Mas – 2011-09-06T19:27:03.233

1Thanks, have tried several tools, either with watermarks or other limitations. GIMP works fine. – Horst Walter – 2011-10-22T00:08:53.750

6Gimp 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. – chrishiestand – 2013-03-05T23:07:13.147

@chrishiestand, You should post that as an alternative answer. – Brad – 2013-03-06T00:21:57.010

Thanks @Brad, but I don't think it is sufficient to stand alone. It's really just an addendum to your answer. – chrishiestand – 2013-03-08T02:25:51.177

94

If you have imagemagick installed, you can just type:

convert myfile.pdf myfile.png

Though personally I prefer the results obtained from pdftoppm from Poppler utilities:

pdftoppm -png myfile.pdf > myfile.png

frabjous

Posted 2010-09-08T00:34:40.340

Reputation: 9 044

Note that if you use imagemagick, you may also need ghostscript: http://stackoverflow.com/q/32466112/1157054

– Ajedi32 – 2016-01-07T02:26:24.943

4on mac with homebrew I had to install imagemagick and ghostscript for this to work.

brew install imagemagick brew install ghostscript – Andreas – 2012-02-20T16:01:21.190

11+1 for pdftoppm: good results and fast. – Olivier 'Ölbaum' Scherler – 2012-10-24T12:42:27.143

1Why 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 – 2013-02-14T04:22:51.707

Poppler does a much better job for me - I've got an input pdf with CYMK colours, with imagemagick the colours come out a crazy bright cyan. Also convert takes ~8 seconds and pdftoppm takes less than 0.5 seconds. Thanks for the pointer! – maxpenguin – 2013-03-08T02:38:21.373

1converting multipage PDF with poppler will look more like this: pdftoppm -png myfile.pdf myfile – Roman Protsiuk – 2013-07-23T15:30:41.703

Informally comparing them head to head, I found pdftoppm about 5x (for PNG) to 16x (for JPG) faster once I adjusted for the same resolution. My test file was a scientific paper 10 pages long. – sandover – 2013-12-11T22:41:22.603

3

See http://blog.alivate.com.au/poppler-windows/ for windows binaries of poppler and use pdftocairo -png

– kromuchi – 2014-01-09T11:51:52.837

15

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

Posted 2010-09-08T00:34:40.340

Reputation: 13 502

On macOS you can also use the build-in sips tool: sips -s format png the_pdf_file.pdf --out the_png_file.png – goetzc – 2019-04-29T00:13:13.400

9

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.

imriss

Posted 2010-09-08T00:34:40.340

Reputation: 287

3Signed up for super user just to upvote this. Now if I only had any hope of remembering it... – joeA – 2014-10-10T02:47:12.627

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

Posted 2010-09-08T00:34:40.340

Reputation: 2 854

6

Another way is

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

(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

Posted 2010-09-08T00:34:40.340

Reputation: 263

+1 for inkscape. Because you can edit the pages, rework the diagrams and save as svg or even as pdf etc... – Alain Pannetier – 2015-10-22T13:31:26.117

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

Posted 2010-09-08T00:34:40.340

Reputation: 111 572

3

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

fabb

Posted 2010-09-08T00:34:40.340

Reputation: 174

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

whiplash

Posted 2010-09-08T00:34:40.340

Reputation: 21

Paint can open PDFs? – Daniel Beck – 2013-06-04T17:59:00.327

@DanielBeck He's saying to open in a PDF viewer, then copy and paste – Canadian Luke – 2013-06-04T18:01:40.883

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

Posted 2010-09-08T00:34:40.340

Reputation: 171