Problem
I need to convert a multipage pdf to jpg-files but ImageMagick keeps throwing errors that are hard to interpret.
Installing ImageMagick
At first I installed it using apt-get, but as I could read that several people had problems doing that, i ended up installing it from source.
My linux distribution (A Docker image):
>lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Installing ImageMagick from source:
# Installing build tools and ghostscript
apt update
apt-get install -y build-essential make ghostscript
# Downloading imagemagick
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
# Installing and cleaning up
tar xvzf ImageMagick.tar.gz && cd ImageMagick-7* && ./configure && make && make install && ldconfig /usr/local/lib && cd .. && rm -r ImageMagick-7*
# Checking ImageMagick version
>magick -version
Version: ImageMagick 7.0.10-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): jpeg x xml zlib
Converting files
# Image to image
>convert test.jpg test.png
# PDF to image
>convert test.pdf test.jpg
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/572.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3304.
Is Ghostscript the problem?
The Ghostscript installation is a common problem for many, but Ghostscript seems to work fine and produce a jpg-file
# PDF to image with Ghostscript
gs -sDEVICE=pngalpha -sOutputFile=test.jpg test.pdf
Do I have to install more Delegates?
The error suggests that there is something off with my limited delegates, so I thought to install all dependencies up front.
# Listing dependencies
>apt update && apt build-dep imagemagick
Reading package lists... Done
E: You must put some 'source' URIs in your sources.list
This is where I got stuck.
question from:
https://stackoverflow.com/questions/65920674/imagemagick-how-do-i-convert-pdf-to-jpg-i-get-error-no-decode-delegate-for-th 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…