Hello i am using python in combination with imagemagick to convert an pdf to a image (jpeg). I installed ImageMagick and the Python Wand module.

when i run the script in Windows 10 it runs perfectly but when i run it under Ubuntu 20.xx i get the following error as response:

Traceback (most recent call last): File "wandExample.py", line 2, in pdf = wi(filename="data/Lucas_Mur.pdf", resolution=300) File "/home/erik_hoeven/.local/lib/python3.8/site-packages/wand/image.py", line 8636, in init self.read(filename=filename) File "/home/erik_hoeven/.local/lib/python3.8/site-packages/wand/image.py", line 9230, in read self.raise_exception() File "/home/erik_hoeven/.local/lib/python3.8/site-packages/wand/resource.py", line 230, in raise_exception raise e wand.exceptions.MissingDelegateError: no decode delegate for this image format `' @ error/constitute.c/ReadImage/562

from wand.image import Image as wi
pdf = wi(filename="data/Lucas_Mur.pdf", resolution=300)
pdfimage = pdf.convert("jpeg")
i=1
for img in pdfimage.sequence:
    page = wi(image=img)
    page.save(filename=str(i)+".jpg")
    i +=1

For the installation of ImageMagick under Ubuntu 20.xxx i executed the following statement:

sudo apt update
sudo apt-get install build-essential
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
./configure` 
make
sudo make install
sudo ldconfig /usr/local/lib
sudo apt-get install -y ghostscript-x

when i test imagemagick by using magick -version the result is:

Version: ImageMagick 7.0.10-31 Q16 x86_64 2020-09-27 https://imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP(4.5) Delegates (built-in): bzlib djvu fontconfig freetype jbig jng jpeg lcms lqr lzma openexr png tiff wmf x xml zlib

I am getting also an error message when i execute the imagemagick command:

convert Lucas_Mur.pdf Output.jpg

convert: no decode delegate for this image format ' @ error/constitute.c/ReadImage/562. convert: no images defined Output.jpg' @ error/convert.c/ConvertImageCommand/3285.

Can you please help to solve this error and explain why i receive this!

0

There are 0 best solutions below