Skip to content
MagickCmdErrors › no images defined / FailedToExecuteCommand `gs'

no images defined / FailedToExecuteCommand `gs'

ImageMagick cannot read PDF or EPS without Ghostscript. How to confirm that is the cause, install it on Linux, macOS and Windows, and verify the delegate is working.

You tried to convert a PDF or EPS and got one of these:

convert: no images defined `output.png' @ error/convert.c/ConvertImageCommand/3234
convert: FailedToExecuteCommand `gs' -sstdout=%stderr ... @ error/pdf.c/InvokePDFDelegate/292

What it means

ImageMagick cannot decode PDF or PostScript on its own. It shells out to the Ghostscript binary, gs. When that binary is missing, Ghostscript is never invoked, ImageMagick reads zero images, and then complains that it has nothing to write — which is why the message talks about the output file rather than the input.

The "no images defined" wording sends a lot of people looking in the wrong place. The problem is the input, not the output.

Confirm it

which gs
gs --version

If that prints nothing, this page is your answer. If Ghostscript is installed, your problem is almost certainly the PDF security policy instead.

Install it

apt install ghostscript        # Debian / Ubuntu
dnf install ghostscript        # Fedora / RHEL
apk add ghostscript            # Alpine
brew install ghostscript       # macOS
pacman -S ghostscript          # Arch

On Windows, download the installer from ghostscript.com and make sure its bin directory is on your PATH. The ImageMagick Windows installer offers Ghostscript as an optional component — it is easy to click past.

Verify the delegate is registered

magick -list delegate | grep -i ps

You should see entries mapping eps, ps and pdf to gs. Then test:

magick -density 150 input.pdf page.png
identify page.png

If it still fails after installing

  1. Check the policy. Installing Ghostscript does not lift the policy.xml block — they are two separate obstacles and you may hit both in sequence. See the policy page.
  2. Restart your shell. A PATH change from a Windows installer needs a new terminal.
  3. Check the PDF is not encrypted. Ghostscript refuses password-protected files. qpdf --decrypt in.pdf out.pdf handles the trivial case of an owner password with no user password.
  4. Check the file is really a PDF. file input.pdf — a renamed download is a surprisingly common cause.

In Docker

Slim base images almost never include Ghostscript:

RUN apt-get update \
 && apt-get install -y --no-install-recommends imagemagick ghostscript \
 && rm -rf /var/lib/apt/lists/*

The alternative

If you only need PDF rasterisation, poppler is lighter and does not carry Ghostscript's history:

apt install poppler-utils
pdftoppm -png -r 300 input.pdf page

Related

Copied