我正在尝试使用wand.image将pdf转换为图像,但不断出现此错误:
wand.exceptions.DelegateError: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" "-sOutputFile=C:/Users/angel/AppData/Local/Temp/magick-32720Q2HUSQhwtDBC%d" "-fC:/Users/angel/AppData/Local/Temp/magick-32720YmkuoFhQVf-T" "-fC:/Users/angel/AppData/Local/Temp/magick-32720i-5wg9xQf3yI"' (The system cannot find the file specified.) @ error/delegate.c/ExternalDelegateCommand/475
我的代码如下:
from wand.image import Image as wi
pdf = wi(filename='Maxis Mar Copy.pdf',resolution=300)
pdfImage = pdf.convert('jpeg')
i = 1
for img in pdfImage.sequence:
page = wi(image=img)
page.save(filename=str(i)+".jpg")
i +=1