Use GhostScript to Export Specified Pages from a PDF as Clear PNG Files
Images exported from PDF files with ImageMagick are usually not clear enough. Because GhostScript can parse the underlying PDF data, it can produce clearer ima…
Images exported from PDF files with ImageMagick are usually not clear enough. Because GhostScript can parse the underlying PDF data, it can produce clearer image files.
The command I use is as follows:
gs \ -sDEVICE=png16 \ -o %03d.png \ -dTextAlphaBits=4 \ -dAlignToPixels=1 \ -dFirstPage=1 \ -dLastPage=1 \ -r300 \ file.pdf
To explain, if the page you want to export has only a few colors, you can specify DEVICE as png256 or png16 to reduce the size of the generated file; if the exported page has only black and white, you can use pngmono. If the page you want to export contains an image with very rich detail, I recommend using jpeg format. In general, if you want the exported image to remain very clear when printed, it is best to specify the DPI as 300; otherwise, 110 is sufficient.