Page 1 of 1

no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T09:38:05-07:00
by evanaad
My home directory contains a file 'mypic.pdf' consisting of a small image. When executing the following command from my home directory:

Code: Select all

convert -density 300 mypic.pdf -quality 90 mypic.png
the following error displays:

Code: Select all

convert: no images defined 'mypic.png' @error/convert.c/ConvertImageCommand/3254.
***

ImageMagick 7.0.6-0 Q16 x86_64 2017-06-12
macOS Sierra 10.12.5

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T09:52:10-07:00
by fmw42
What is your platform? In IM 7 convert is replace by magick. Does that make it work? Do you have all the delegates installed, especially for libpng?

What do you get from

Code: Select all

magick -version

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T09:54:41-07:00
by evanaad
> What is your platform?

macOS Sierra 10.12.5

> Do you have all the delegates installed, especially for libpng?

Don't know. How to check?

> What do you get from

Code: Select all

magick -version

Code: Select all

Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-06-12 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T09:59:01-07:00
by fmw42
How did you install it -- from source, from binary or from Macports of Homebrew. Please answer my question about what you get from

Code: Select all

magick -version
That will tell me what delegates you have installed. Your error is not about reading the PDF, but writing the output PNG.

Does this work:

Code: Select all

magick -density 300 mypic.pdf -quality 90 mypic.png
IM 7 uses magick, not convert

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T10:31:19-07:00
by evanaad
> How did you install it -- from source, from binary or from Macports of Homebrew.

Homebrew.

> Please answer my question about what you get from

Code: Select all

magick -version
I already did. See my previous answer.

> Does this work:

Code: Select all

magick -density 300 mypic.pdf -quality 90 mypic.png
No, it doesn't. It produces the following error messages:

Code: Select all

magick: no images for write '-write' 'mypic.png' at CLI arg 6 @ error/operation.c/CLINoImageOperator/4771.
magick: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2561.
magick: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3499.
magick: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2449.
magick: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3499.
magick: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2480.
magick: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3499.
Extra information

The problems occur when I execute the command from inside the Emacs text editor. When I execute it from Terminal (the macOS command-line console), the command runs successfully.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T11:00:51-07:00
by GeeMack
evanaad wrote: 2017-07-05T10:31:19-07:00The problems occur when I execute the command from inside the Emacs text editor. When I execute it from Terminal (the macOS command-line console), the command runs successfully.
Sounds like it might be write permissions on the Emacs default directory. Try the command using the full path for your output image.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T11:07:22-07:00
by evanaad
> Try the command using the full path for your output image.

The same error displays but with the full path:

Code: Select all

convert: no images defined `/Users/evanaad/mypic.png' @ error/convert.c/ConvertImageCommand/3254.
For those not familiar with Emacs: Emacs has a built-in shell similar to Terminal. I execute the commands in it.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T11:18:50-07:00
by Bonzo
Did not read OP's post properly.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T14:25:33-07:00
by evanaad
> Sounds like it might be write permissions on the Emacs default directory.

I don't think so:

Code: Select all

echo "Hello, world!" > myfile.txt
works as expected.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T14:38:13-07:00
by Bonzo
Have you tried a different type of input file; for instance a jpg?

Code: Select all

magick input.jpg output.png

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T14:45:54-07:00
by evanaad
> Have you tried a different type of input file; for instance a jpg?

I have now. The command works with input.gif and input.jpg.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T14:51:56-07:00
by fmw42

Code: Select all

Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
Your delegates do not show gslib. Do you have Ghostscript installed? Check

Code: Select all

gs --version
Does that return a version number and is it current?

Odd that the message is about png and not pdf!

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T14:58:22-07:00
by evanaad
> Your delegates do not show gslib.

This is the same list of delegates as the one produced in the Terminal, and Image Magick has no problem converting pdf to png in the Terminal.

> Do you have Ghostscript installed? Check

Code: Select all

gs --version
When run from the Terminal, the output is

Code: Select all

9.21
When run from Emacs, the output is

Code: Select all

/bin/bash: gs: command not found

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-05T15:09:52-07:00
by evanaad
I've added the path to the gs executable to the Emacs search path, by adding the following lines to my Emacs init file (~/.emacs) and restarting Emacs:

Code: Select all

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin/"))
(setq exec-path (append exec-path '("/usr/local/bin/")))
Now Image Magick can convert pdf to png from Emacs, and my original problem is solved!

Thanks everyone.

Re: no images defined @error/convert.c/ConvertImageCommand/3254

Posted: 2017-07-07T07:48:29-07:00
by tnaughts
I am running into a similar issue in converting a pdf into an image. I am trying to convert a pdf to a jpeg image using Rmagick. I am running into some trouble with the following code:

Code: Select all

pdf_link = "https://staging.shurpa.com/deliveries/BtrPsIxl/label.pdf"

file = Tempfile.new(['order', '.jpeg'])
    p pdf_link
    p file.path 
    im = ImageList.new(pdf_link)
    puts "SUPP"
    im.write(file.path.to_s)
    
I recieve this error:

Code: Select all

"https://staging.shurpa.com/deliveries/BtrPsIxl/label.pdf"
"/var/folders/qm/yk_w5d9545j_6wqk6100dhjm0000gq/T/order20170706-43294-
15myct1.png"

Magick::ImageMagickError: unable to open file `/var/folders/qm/yk_w5d9545j_6wqk6100dhjm0000gq/T/magick-43294MCNyzIu4Oenn': No such file or directory @ error/constitute.c/ReadImage/544from/Users/timnaughton/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick_internal.rb:1616:in `read'
However the code works perfectly fine when I feed it this pdf_string:

Code: Select all

"https://shippo-delivery-east.s3.amazonaws.com/b2a3e1cd070748cd80b492aa421832a3.pdf?Signature=nf6woycGiOydPI8eSnLcq3r0tEc%3D&Expires=1530816480&AWSAccessKeyId=AKIAJGLCC5MYLLWIG42A"



Version: ImageMagick 6.9.8-10 Q16 x86_64 2017-06-12 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib