3

我有一个两页的 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

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

4

2 回答 2

7

你离得太近了,你会生气的;-)

在阅读了一些手册页之后,这对我有用:

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

DEVICE代替Device, 而-o代替-o=

万一这很重要,我的gs版本是:

GPL Ghostscript 9.05 (2012-02-08)
于 2013-10-21T17:48:14.763 回答
1

试试这个,它对我很有效,它得到了很好的结果:

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

但是我猜想使用 -r400 是用于 JPEG 图像而不是 PNGS

于 2013-10-22T12:08:50.403 回答