没有从GhostScript PDF到PNG转换的输出文件

我有一个两页的PDF我试图转换成PNG文件。 当我运行:

gs -sDevice=pngalpha -o=gs-output-%d.png -r400 test1-0.pdf 

我得到:

 GPL Ghostscript 9.07 (2013-02-14) Copyright (C) 2012 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 2. Page 1 %%BoundingBox: 35 35 577 757 %%HiResBoundingBox: 35.910001 35.910001 576.090022 756.090029 Page 2 %%BoundingBox: 35 35 577 757 %%HiResBoundingBox: 35.910001 35.910001 576.090022 756.090029 

然后…什么都没有 根本没有输出文件。 我哪里错了?

你太亲密了,你会生气;-)

在阅读了一下manpage之后,发现了一些对我有用的东西:

 gs -sDEVICE=pngalpha -ogs-output-%d.png -r400 test1-0.pdf 

DEVICE而不是Device ,和-o而不是-o=

如果重要的话,我的gs版本是:

 GPL Ghostscript 9.05 (2012-02-08) 

试试这个和我完全一样的东西,它会得到很好的结果:

 -sDEVICE=pngalpha -o "$OUTPUTIMAGEFILE" -dFirstPage=1 -dLastPage=2 -dNOPAUSE -dGraphicsAlphaBits=4 -dTextAlphaBits=4 "$INPUTPDFFILE" 

但是,我猜测使用-r400是JPEG图像而不是PNGS