"Image not found" when using ImageMagick on Sierra (beta)

I had the same problem. What worked for me was removing from the $PATH a problematic previous installation, then reinstalling:

brew update && brew upgrade
brew remove imagemagick
brew install imagemagick

Then when I ran:

which convert

I finally got the brew version:

/usr/local/bin/convert

And when I ran the command from the tutorial:

convert [email protected] -fill white -font Times-Bold -pointsize 18 -gravity south -annotate 0 "Hello World" test.png

I got the Hello World image.


UPDATE

I've checked the page you got your package from, and it looks like my hypothesis was correct - you're missing a path variable, MAGICK_HOME. Luckily it seems easy to correct.

You need to get the absolute path of the directory where ImageMagick is. In a pinch, you can search for it everywhere - run this from command line:

find / -type d -name "ImageMagick-7.0.3" 2>/dev/null

It should answer with exactly one ImageMagick directory (unless you installed it more than once in different places, in which case you need to determine which of the two is the "correct" package).

As an alternative, if you issue the command

which convert

it should tell you the full path of the convert executable, which should be in the bin subdirectory of the ImageMagick installation.

Suppose that it says that the directory is

/Users/lserni/Desktop/test/ImageMagick-7.0.3

then before using ImageMagick in the terminal, you need to issue these commands:

export HOME=/Users/lserni/Desktop/test
export MAGICK_HOME="$HOME/ImageMagick-7.0.3"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"

Now you can try ImageMagick:

convert logo: logo.gif
identify logo.gif

It should give something like,

logo.gif GIF 640x480 640x480+0+0 8-bit sRGB 256c 28.6KB ...

ORIGINAL ANSWER

dyld: Library not loaded: /ImageMagick-7.0.1/lib/libMagickCore-7.Q16HDRI.0.dylib Reason: image not found

There are several possible reasons. The one that strikes me as the likeliest is that the library is, actually, not "there" -- "there" meaning a directory called "ImageMagick-7.0.1" in the volume root. The library might be in /usr, or /lib, or /opt, but the error above says that it's looking for it in /ImageMagick-7.0.1.

Try typing this in the terminal to query that path:

ls -la /ImageMagick-7.0.1/lib/libMagickCore-7.Q16HDRI.0.dylib

I've found a reference implying that you can redirect a ldpath from an executable if it contains the wrong path, but I have not yet tried it:

install_name_tool -change /ImageMagick-7.0.1/lib/libMagickCore-7.Q16HDRI.0.dylib /usr/local/lib/libMagickCore-7.Q16HDRI.0.dylib /usr/local/bin/NameOfImageMagickBinaryYou'ReCalling

(the binary is probably /usr/local/bin/convert )

...and, possibly, there are other libraries and other IM binaries with the same problem.

Another possibility is that the library is there, but it's trying to load, in turn, other libraries that aren't there. libPNG, JPEGlib, libTIFF and so on are all likely candidates. While you can delve into the matter using tools such as strace, perhaps it's best if you check the installation from the beginning.

Finally, you might have a permission error either in the dylib, or in the path leading to that dylib. This can happen if you install as root (or the installation runs as root), the library directories are created with more secure permissions (e.g. 750 instead of 755), and then you run the application as a different and/or less privileged user/group.

If you installed ImageMagick through Homebrew, check also HB's configured paths. Your symptoms remind me very much of what would happen if the install script ran with --prefix= instead of --prefix=/usr/local.