Jun 26, 2009
ImageMagick on iPhone – UPDATE
UPDATE: iOS4.3 and Xcode4
PLEASE READ THE UPDATE
I’ve been busy working on an iPhone project using ImageMagick the last month, and one thing has kept on bugging me: Some functionality just wasn’t working!!!
In particular I discovered that ImageMagick uses some XML configuration files for some of its internal operations. You can find the whole reading about them on ImageMagick site.
After fiddling, deciding to not care, re-deciding that I WANTED THE FUNCTIONALITY here’s the solution (as usual in steps):
-
The Files that need to be copied over are stored, if you use my script to compile ImageMagick under the installation directory:
~/Desktop/tmp_target/imagemagick/lib/ImageMagick-6.5.3/config
~/Desktop/tmp_target/imagemagick/share/ImageMagick-6.5.3/config -
XCode needs to import such files, so that they can be copied over to the destination application. In particular add them to the Resources directory with the usual method for adding files:
Right click on the Resources folder -> Add -> Existing Files…
and select all the.xmlfiles in the two folders above. -
The Code somewhere, like in a function that gets called only once (
viewDidLoad, for instance), this may vary depending on your program, add the two following lines:NSString * path = [[NSBundle mainBundle] resourcePath]; setenv("MAGICK_CONFIGURE_PATH", [path UTF8String], 1);
Done, now ImageMagick knows where to look for the needed configuration files and will work like a breeze for you.
YES! It was this easy. But not to discover, trust me! :P
[...] ImageMagick on iPhone – UPDATE [...]