pythonwindowsimagemagickghostscriptwand

How to install Python wand on Windows?


I installed wand with pip install wand, and the ImageMagick DLL (coming from ImageMagick-7.1.0-46-Q16-HDRI-x64-dll package) is in the PATH.

Doing this:

import wand.image

with wand.image.Image(filename='test.pdf', resolution=300) as pic:
    with wand.image.Image(pic.sequence[0]) as first_page:
        first_page.save(filename='test.jpg')

produces this error:

wand.exceptions.MissingDelegateError: NoDecodeDelegateForThisImageFormat `PDF' @ error/constitute.c/ReadImage/741

How to solve this wand problem?

Ghostscript is installed on my system (and in the PATH too). I tried with gs64 and gs32 versions (according to this answer: PythonMagick can't find my pdf files).

I have also read the Wand Windows installation doc.

The question install wand on a windows machine, How to install python imagemagick at windows 7. I followed these instruction and Imagemagick Convert PDF to JPEG: FailedToExecuteCommand `"gswin32c.exe" / PDFDelegateFailed are linked but did not help. (I remember I already struggled with this years ago, I don't remember if I finally found a solution)


Solution

  • I finally solved it by uninstalling ImageMagick portable version (all directories were in the PATH though), and reinstalling the standard ImageMagick from https://imagemagick.org/script/download.php#windows:

    ImageMagick-7.1.0-46-Q16-HDRI-x64-dll.exe
    

    I checked all the checkboxes (except Perl related).

    Then it worked.