Daniel Del Core
Daniel Del Core

Reputation: 3221

GhostScript alternative

Im currently using CentOS 5.6 (Ghostscript 8 - ImageMagick-6.2.8 ) and im trying to convert the first image of the pdf to a jpg file.

I understand that my current setup is unable to convert compressed pdf files, but is there an alternative that it can use with the same functionality?

Upvotes: 2

Views: 3129

Answers (1)

Kurt Pfeifle
Kurt Pfeifle

Reputation: 90203

The 'understanding' that Ghostscript is unable to convert 'compressed PDF' is wrong. Where did you pick it up?

PDF by default uses compression internally for most its objects. It's rather unusual to find a PDF 'in the wild' which is completely uncompressed.

Which exact version of Ghostscript are you using? (Try gs -v).

BTW, you do not need ImageMagick to convert (multipage) PDF to a series of JPEGs. Try this command:

 gs \
   -o img_%03d.jpeg \
   -sDEVICE=jpeg \
    input.pdf

or, for a resolution of 300 dpi (instead of the default 72 dpi):

 gs \
   -o img_%03d.jpeg \
   -sDEVICE=jpeg \
   -r300 \
    input.pdf

The _%03d-part of the output filename will attach a 3-digit number to the img-name that increments with each PDF page.

Upvotes: 3

Related Questions