Tuesday, February 14, 2012

JPG from PDF in Linux (ghostscript)

Renamed input.pdf for copy/paste
Put in Documents folder
Open Terminal in Documents Folder

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -sOutputFile=output_%d.jpg input.pdf

Other options to try:

DEVICE=png16m
r300

1 comment:

Ben Rousch said...

I've been working on a program to convert PDFs (especially big, unflattened ones) to more resource-friendly formats like TIFF for printing. I leverage ImageMagick, which uses Ghostscript, to do the conversions. The general structure of my conversion command is:
`convert -compress Group4 -density 300 -type Grayscale -background white -flatten in_pdf out_tif`.

You can check out the project at https://sourceforge.net/projects/pdfserenitynow/ . I'll be adding bursting of PDFs before conversion with PDFTK (saves a lot of RAM during conversions) and JPG to it some day.