Pavel
Pavel

Reputation: 5866

Imagemagick: no images defined (for output filename)

I'm trying to to do a basic convert:

$ convert image.png out.jpg

but getting error

convert-im6.q16: no images defined `out.jpg' @ error/convert.c/ConvertImageCommand/3258.

Why does it say "no images defined" if out.jpg is output image name?

$ ls
image.png
$ convert -version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib

Upvotes: 14

Views: 18095

Answers (5)

Ferdinand Rau
Ferdinand Rau

Reputation: 11

Another reason for the very same error can be a corrupt input file (image.png).

Even if your favourite image viewer is capable of recovering (parts of?) the corrupted image, imagemagick might still refuse to convert it.

It happened to me before with interrupted downloads.

Upvotes: 1

eartahhj
eartahhj

Reputation: 41

Credits to:

My solution was to both change the policy.xml file: <policy domain="coder" rights="read|write" pattern="PDF" />

And to install GhostScript with: apt install ghostscript

After that, Imagick v6 (with Convert) was able to convert a PDF into a JPG on Debian 11.

Hope this can help others like me who spent hours on researching for a solution!

Upvotes: 1

ryan.hausen
ryan.hausen

Reputation: 386

I had the same issue and found the solution here: https://askubuntu.com/a/1195393.

In my case, the image I was trying to convert had dimensions that were larger than the ImageMagick policy limits. To fix this, go to /etc/ImageMagick/policy.xml and edit the the following lines:

<policy domain="resource" name="width" value="10KP"/>
<policy domain="resource" name="height" value="10KP"/>

value is currently set to 10KP=10,000 pixels, so if your image is larger than that it won't be recognized by ImageMagick. Change value to be larger than the dimensions of the image you are working with.

Upvotes: 17

Rıdvan
Rıdvan

Reputation: 61

replace your policy.xml with the code below, solved my case.

!!!! it will bypass any limit because no limit policy given.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
  <!ELEMENT policymap (policy)*>
  <!ATTLIST policymap xmlns CDATA #FIXED ''>
  <!ELEMENT policy EMPTY>
  <!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
    name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
    stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>
<policymap>
  <policy domain="Undefined" rights="none"/>
</policymap>

Upvotes: 6

Zachary Vance
Zachary Vance

Reputation: 894

For me, this happened when /tmp was full.

Upvotes: 0

Related Questions