2013-10-21 48 views
2

我有一個兩頁的PDF我試圖轉換爲PNG文件。當我運行:沒有輸出文件從GhostScript 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 

然後什麼都沒有。根本沒有輸出文件。我哪裏錯了?

回答

6

你是如此接近,你會生氣;-)

有點手冊頁閱讀這裏後是爲我工作:

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

DEVICE,而不是Device,並-o代替-o=

在如此重要的情況下,我gs的版本是:

GPL Ghostscript 9.05 (2012-02-08) 
+0

美麗!像'GPL Ghostscript 9.07(2013-02-14)'上的魅力一樣工作。 – JacobEvelyn

1

試試這個與我理想的工作,並取得了很好的效果:

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

但是我猜,使用-r400是JPEG圖像不PNGS

相關問題