Trying to use the Imagemagick toolbox (for me, installed via MacPorts) sometimes doesn’t work (for example, converting a png image) in Matlab because Matlab for some reason uses the libraries in its path over those given in system call (this is for Mac, but probably for *nix and maybe even Windows).
This is an example call:
[s,w] = system([IMAGEMAGICK_PATH,'convert ',pwd,'/',outfile,'.png -rotate 90 ',pwd,'/',outfile,'.png']);
This is the error:
error:
dyld: Library not loaded: /opt/local/lib/libtiff.3.dylib
Referenced from: /opt/local/bin/convert
Reason: Incompatible library version: convert requires version 12.0.0 or later, but libtiff.3.dylib provides version 11.0.0
The work around is to replace the Matlab library with the ImageMagick one (only need to do this once and will stay until you upgrade Matlab):
cd /Applications/MATLAB74/bin/maci/ (or wherever your Matlab is installed)
mv libtiff.3.7.1.dylib libtiff.3.7.1.dylib.MATLAB (give it a different name)
ln -s /opt/local/lib/libtiff.3.dylib libtiff.3.7.1.dylib (create a soft link to the Imagemagick library file)
EDIT: This is the much better way to handle this:
setenv(‘DYLD_LIBRARY_PATH’,['/opt/local/lib/:' getenv('DYLD_LIBRARY_PATH')])