Imagemagick: no images defined (for output filename)
Asked Answered
S

5

14

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
Shill answered 11/11, 2020 at 17:53 Comment(2)
Looks like IM can’t deal with PNG files. Quick test. Try convert xc:red red.png and see if that makes a 1-pixel red PNG.Bogie
@MarkSetchell yes, it made 1-pixel red pngShill
L
14

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.

Lyndonlyndsay answered 9/11, 2021 at 18:19 Comment(1)
why doesn't it just say the specific error?Recency
T
5

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>

Triquetrous answered 4/7, 2023 at 18:26 Comment(0)
L
1

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!

Lucrecialucretia answered 21/10, 2023 at 12:54 Comment(0)
E
1

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.

Effusive answered 15/1, 2024 at 5:7 Comment(0)
L
0

For me, this happened when /tmp was full.

Lynden answered 17/9, 2022 at 18:44 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.