There is no decoding delegate for this PNG image format

I am writing a django / python application and I need to convert the PDF files uploaded by the user to JPEG files (files are scanned)

I try to use the wand with the ImageMagick backend (on OSX) and I keep getting the following error:

MissingDelegateError at /user_docs/upload/certificate/
no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/501

My current test code is as simple as:

with wandImage(filename='/Users/username/Pictures/telechargement.pdf') as img:
    img.format = 'jpeg'
    img.save(filename='/Users/username/Pictures/bzzz.jpeg')

Some information:

  • File exists (I check with os.path.exists)
  • I can convert the file from pdf to jpg on the command line using convert
  • I tried installing DYLD_LIBRARY_PATHto include the ImageMagick lib directory
  • identify -list configure | grep DELEGATES returns

DELEGATES bzlib fftw fontconfig freetype gs jpeg jng lcms2 lzma mpeg png tiff x11 xml zlib

Anyone have an idea?

thank

+4
source share
1 answer

OK, I found it! As always, the key is RTFM:

http://docs.wand-py.org/en/0.4.0/guide/install.html#install-imagemagick-on-mac

:

$ export MAGICK_HOME=/opt/local
+2

Source: https://habr.com/ru/post/1598229/


All Articles