Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Wand:此图像格式没有解码委托`';_Python_Imagemagick_Imagemagick Convert_Wand - Fatal编程技术网

Python Wand:此图像格式没有解码委托`';

Python Wand:此图像格式没有解码委托`';,python,imagemagick,imagemagick-convert,wand,Python,Imagemagick,Imagemagick Convert,Wand,我使用Wand将第一页从PDF文件转换为jpg文件,然后用另一个脚本应用一些过程 我的问题是:从昨天开始,我得到了这个错误,我没有得到任何解决方案。我试图重新安装imagemagick,但没有效果 这是回溯消息: Traceback (most recent call last): File "conversion.py", line 9, in <module> convert = Image(filename="/Users/valentinjungbluth/Des

我使用Wand将第一页从
PDF文件
转换为
jpg文件
,然后用另一个脚本应用一些过程

我的问题是:从昨天开始,我得到了这个错误,我没有得到任何解决方案。我试图重新安装
imagemagick
,但没有效果

这是回溯消息:

Traceback (most recent call last):
  File "conversion.py", line 9, in <module>
    convert = Image(filename="/Users/valentinjungbluth/Desktop/NAPS_PDF/" + PDF)  
  File "/usr/local/lib/python2.7/site-packages/wand/image.py", line 2744, in __init__
    self.read(filename=filename, resolution=resolution)
  File "/usr/local/lib/python2.7/site-packages/wand/image.py", line 2822, in read
    self.raise_exception()
  File "/usr/local/lib/python2.7/site-packages/wand/resource.py", line 222, in raise_exception
    raise e
wand.exceptions.MissingDelegateError: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504
Exception TypeError: TypeError("object of type 'NoneType' has no len()",) in <bound method Image.__del__ of <wand.image.Image: (empty)>> ignored
多谢各位

编辑:

它使用以下简单脚本:

#-*- coding: utf-8 -*-

from wand.image import Image
import os

with Image(filename="/Users/valentinjungbluth/Desktop/NAPS_PDF/arrow.pdf", resolution=200) as convert : 

        convert.compression_quality = 150 #Qualité en %
        convert.save(filename="/Users/valentinjungbluth/Desktop/PDF_to_JPG/test.jpg") #Enregistrement en JPEG sous la forme nom.jpg
解决方案:

在MacOSX上,我有一个名为:.DS\u Store的文件
我必须删除它或只是采取.pdf文件!我的错误来自这个.DS\u存储文件

您是否安装了
ghostscript
?@Compadre是:
警告:ghostscript-9.19已经安装了
,运行脚本时它是否在$PATH中?它看起来像是在Mac上,因此
.DS\u Store
将在PDF列表中,并引发异常。它将再次出现,更好的解决方案是添加检查:
如果PDF.endswith('.PDF'):
#-*- coding: utf-8 -*-

from wand.image import Image
import os

with Image(filename="/Users/valentinjungbluth/Desktop/NAPS_PDF/arrow.pdf", resolution=200) as convert : 

        convert.compression_quality = 150 #Qualité en %
        convert.save(filename="/Users/valentinjungbluth/Desktop/PDF_to_JPG/test.jpg") #Enregistrement en JPEG sous la forme nom.jpg