6

I need to convert pdf files into image files (like: png (prefer), jpeg).

I used convert (from the ImageMagick package) but it takes more than 4 seconds for a 2 page pdf file with only tables (something like an invoice), so this pdf is really light. I found out that convert uses gs to do it. If I do this with gs, the result can be of better quality, and rendered faster.

So I have 3 questions:

  1. Should I use some specific flags in ghostscript package compilation process to make it work faster?
  2. What options for gs can help me get png or jpg files faster and with better quality?
  3. Where can I find documentation about conversion from pdf to image formats?
  • 1
    'If I do this with gs, the result can be of better quality, and rendered faster.' - Do you mean that your gs call is as slow or slower than a convert call and produces output of lower quality? Btw, I suggest to add two examples, how you called convert and gs. – maxschlepzig Jan 7 '12 at 15:36
  • is it possible to resize image with help gs ? – user1016265 Jan 7 '12 at 21:14
5

You can check-out pdfdraw from mupdf (package mupdf-tools under Debian/Debian-derivatives).

From its description:

pdfdraw will render a PDF document to image files. The supported image formats are: pgm, ppm, pam and png. Select the pages to be rendered by specifying a comma separated list of ranges and individual page numbers for example: 1,5,10-15). In no pages are specified all the pages will be rendered.

Perhaps it is faster for your use case.

For example mupdf (a PDF viewer) is really fast (and consumes very little memory) for a lot of documents I tested it with.

  • it's renamed to mudraw – Feng Aug 21 '15 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.