I’ve been working on some speculative projects for Splitwise this week (fun!). I ran into some issues where I needed to do more image manipulation than is possible in iOS, so I needed to add some magic to my project. Ahem. I mean ImageMagick.
Fortunately for me, Claudio Marforio did the work to build ImageMagick for iOS armv6 and armv7. Unfortunately, I need libraries that work with armv7 and armv7s for the newer iOS devices. With some time spent tweaking build files, I was able to update his script and put together my own version that supports the newer hardware.
For most of you, there’s no need to build your own version.
I’m working with Claudio to get this update pushed out to the official ImageMagick ftp, but you can grab a copy now. Update: Claudio published the updated files to the ImageMagick FTP site.
Once you’ve got the files, add the whole folder to your Xcode project and adjust some settings (Build tab of the project information):
- Other Linker Flags: -lMagickCore -lMagickWand -lz -lbz2 -ljpeg -lpng
- Header Search Paths: $(SRCROOT) – make it Recursive
- Library Search Paths: $(SRCROOT) – make it Recursive
On the lower left click on the small-wheel and select: Add User-Defined Setting
- Key: OTHER_CFLAGS
- Value: -Dmacintosh=1
In Link Binary with Libraries under Build Phases, you may also need to add:
You should be able to start using ImageMagick at this point! If you have any issues, please pull down the github repository for the project and make sure the IM_Test project works for you. Or comment on this blog post, and I’ll try to help if I can.