convert: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET

2019-02-12 17:31:10
ImageMagick之PDF转换成图片(image)

安装完ImageMagick之后,直接执行“magick convert f:\parseWord\tmp\testpdf.pdf f:\parseWord\tmp\testpdf.jpg”,会报错:

1
2
3
4
5
convert: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=C:/Users/pc/AppData/Local/Temp/magick-93208IyLP_klqfgpM%d" "-fC:/Users/pc/AppData/Local/Temp/magick-93208rnBVeMlSCx90" "-fC:/Users/pc/AppData/Local/Temp/magick-93208pA1SIsPmWqDw"' (系统找不到指定的文件。
) @ error/delegate.c/ExternalDelegateCommand/460.
convert: PDFDelegateFailed `系统找不到指定的文件。
' @ error/pdf.c/ReadPDFImage/783.
convert: no images defined `f:\parseWord\tmp\testpdf.jpg' @ error/convert.c/ConvertImageCommand/3253.

  

 

这是因为没有安装ghostscript,下载地址:http://ghostscript.com/download/gsdnld.html

 

下载安装之后,再执行命令:“magick convert f:\parseWord\tmp\testpdf.pdf f:\parseWord\tmp\testpdf.jpg”,

 

可以看到在指定路径下的文件夹出现了三个JPG文件,这是因为ImageMagick在转换PDF文件时会根据PDF文件的页数生成图片。


 


您需要安装 Ghostscript 才能使用ImageMagick栅格化矢量文件(PDF,EPS,PS等)。在进行这些操作时,IM会向Ghostscript发出声明(如果在IM调用中使用 -verbose 标记,则可以看到它)。您也可以单独使用Ghostscript来栅格化矢量文件。


  • 2017-11-01 01:30:45

    解决第三方包内jar包冲突

    这个问题就是因为引入jar包的冲突,这时我们可以在build.gradle中添加如下代码,下方单独的是添加的代码

  • 2017-11-06 01:00:17

    撤销git add

    如何撤销git add,不小心执行了git add . 操作,但是又不能提交所有的文件,因为对应不同的分支,现在怎么样可以将git add 撤销回来

  • 2017-11-10 00:06:15

    CORS: credentials mode is 'include'

    XMLHttpRequest cannot load http://localhost/Foo.API/token. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:5000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.