0

I am using wand.image package to convert pdf into image file in Python 3 but I am getting an OS Error. I am not able to get around this OSError. Any help would be truly appreciated.

import os
from wand.image import Image as Img

pdf = Img(filename='test.pdf', resolution=200)

OSError                                   Traceback (most recent call last)
<ipython-input-4-afa6ce7d6c5b> in <module>()
----> 1 pdf=Img(filename='test.pdf',resolution=200)

~\Anaconda3\lib\site-packages\wand\image.py in __init__(self, image, blob, file, filename, format, width, height, depth, background, resolution, pseudo)
   6404                     self.read(blob=blob, resolution=resolution)
   6405                 elif filename is not None:
-> 6406                     self.read(filename=filename, resolution=resolution)
   6407                 # clear the wand format, otherwise any subsequent call to
   6408                 # MagickGetImageBlob will silently change the image to this

~\Anaconda3\lib\site-packages\wand\image.py in read(self, file, filename, blob, resolution)
   6791         elif filename is not None:
   6792             filename = encode_filename(filename)
-> 6793             r = library.MagickReadImage(self.wand, filename)
   6794         if not r:
   6795             self.raise_exception()

OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFF
Hiadore
  • 686
  • 3
  • 15
  • What OS yo use? Have you installed Image Magick? It is required by wand – Hiadore Jul 05 '19 at 01:48
  • 1
    As @Hiadore pointed out, you need to install Image Magick. If you get a PolicyError afterwards, refer to [this link](https://stackoverflow.com/a/52701227/11666391). – Sıddık Açıl Jul 05 '19 at 01:53
  • I am using Windows 10. I have installed Image Magick using this link https://imagemagick.org/download/binaries/ImageMagick-7.0.8-52-Q16-x64-dll.exe – Mayank Daga Jul 05 '19 at 14:05
  • I have already installed Ghostscript that has solved some of the problems but I am not able to get around this specific error mentioned above. – Mayank Daga Jul 05 '19 at 14:08
  • Check your ImageMagick policy.xml file to see if it is limited access to PDF. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Jul 06 '19 at 19:44
  • Better log an [issue](https://github.com/emcconville/wand/issues) with the development team. The OSError hints at memory violation, so either an incompatible library is present, or a bug exists. – emcconville Jul 10 '19 at 12:59

0 Answers0