欢迎光临散文网 会员登陆 & 注册

使用ghostscript将PDF转为png图片

2022-06-23 16:21 作者:梅狄威尔  | 我要投稿

gs -dSAFER -dBATCH -dNOPAUSE -r300 -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=%03d.png run3_0_HA1.pdf

参数说明:

-dSAFER:Enables access controls on files.

-dBATCH:Causes Ghostscript to exit after processing all files named on the command line, rather than going into an interactive loop reading PostScript commands.

-dNOPAUSE:Disables the prompt and pause at the end of each page. 

-r300:Select the resolution on  printer; Control  the density of pixels when rasterizing to an image file. 300→300 dpi

-sDEVICE: Selects which output device Ghostscript should use. Check: https://ghostscript.com/doc/current/Devices.htm

-dTextAlphaBits and -dGraphicsAlphaBits: These options control the use of subsample antialiasing. Their use is highly recommended for producing high quality rasterizations. The subsampling box size n should be 4 for optimum output, but smaller values can be used for faster rendering. Antialiasing is enabled separately for text and graphics content. Allowed values are 1, 2 or 4.

-sOutputFile: Selects an alternate output file (or pipe) for the initial output device. 

Examples:

-sOutputFile=ABC-%d.png

produces 'ABC-1.png', ... , 'ABC-10.png', ..

-sOutputFile=ABC-%03d.pgm

produces 'ABC-001.pgm', ... , 'ABC-010.pgm', ...

-sOutputFile=ABC_p%04d.tiff

produces 'ABC_p0001.tiff', ... , 'ABC_p0510.tiff', ... , 'ABC_p5238.tiff'

When using MS Windows console (command.com or cmd.exe), you will have to double the % character since the % is used by that shell to prefix variables for substitution

(run3_0_HA1.pdf): Input file name


参考资料:https://ghostscript.com/doc/current/Use.htm

使用ghostscript将PDF转为png图片的评论 (共 条)

分享到微博请遵守国家法律