ImageMagick wand not recognizing pdf image?
Asked Answered
M

1

8

I'm trying to use this blog post to convert one pdf to a jpg, however everytime I try to run this simple script I get this exception wand.exceptions.WandError: wand contains no images MagickWand-56' @ error/magick-image.c/MagickWriteImage/13001

from wand.image import Image

with Image(filename="myFile.pdf") as img:
    img.save(filename="myFile.png")

I'm using the latest version of Wand and Python 3.4.2. The only thing I can think of is possibly a version compatibility issue.

Madi answered 30/12, 2014 at 1:53 Comment(8)
I just tested this example myself on Ubuntu 14.04 x64 and python 3.4.1 and it works. Are you sure "myFile.pdf" actually exists? maybe its wrong path or filename?Gerena
Yeah. I've used the full path, the relative and the filename. Same error.Madi
Have you checked with different pdf? maybe this pdf is corrupted, or it is not an usual one (e.g. some security rules or something else).Gerena
Just created a brand new blank 'test.pdf'. Same error.Madi
maybe then some libraries missing. do you use linux/windows/mac? check what is required there for pdfs? ghostscript maybe?Gerena
That was it. Ran brew install ghostscript and it worked. Thanks!Madi
@Marcin: Please post an answer so we can vote it up!Thunderclap
@Thunderclap Thx. I just made an answer.Gerena
G
9

So just to close the question, the problem is missing ghostscript library on mac, as indicated in my comment above:

"maybe then some libraries missing. do you use linux/windows/mac? check what is required there for pdfs? ghostscript maybe? "

Gerena answered 30/12, 2014 at 3:20 Comment(1)
In case this helps somebody else: I got the same error message, installed imagemagick with ghostscript bindings, reinstalled wand and still got the error along with a message complaining about X11. After I installed the latest XQuartz everything worked. This was on OS X 10.0.4Drum

© 2022 - 2024 — McMap. All rights reserved.