I want to convert the cover page of a PDF into an image. so far, i have heard about 2 image processing tools in Linux. They are
For PDF conversion, ImageMagick runs Ghostscript behind the scene. To install Ghostscript in Mac, you can download the dmg @ UPFLYSOFT.
After the installation, you can run the gs command in shell. Here is the command to convert a PDF cover into PNG.
- gs -q -sDEVICE=pngalpha -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -r300 -sOutputFile=cover.png sample.pdf
You can even convert the image to mono color by simple modify the sDEVICE parameter to pngmono. If you want to convert other pages, just modify the dFirstPage and dLastPage parameters. And if you want to know the available sDEVICE, enter the following command.
- gs -h
Thanks Scott @ Moving to Freedom
- Moving to Freedom – Converting PDFs into Image Files
- UPFLYSOFT – Ghostscript for Mac OS X 8.71 freeware