Skip to content
Script and instructions to compile imagemagick as a static library to use in any iPhone project
C Shell Objective-C C++
Branch: master
Clone or download
Pull request Compare This branch is 24 commits behind marforic:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
IM_Test
.gitignore
README.textile
imagemagick_compile.sh

README.textile

Compiled downloads

You can grab the latest compiled ImageMagick directly from their ftp or any mirror.

There is always 2 packages for the compiled ImageMagick:

  • iOSMagick-VERSION-libs.zip
  • iOSMagick-VERSION.zip

The first one includes headers and compiled libraries that have been used to compile ImageMagick. Most users would need this one.

ImageMagick compiling script for iPhone OS and iPhone Simulator

The directory structure has to be:

./cross_compile/ImageMagick-VERSION/     <- ImageMagick top directory

./cross_compile/IMDelegataes/	                <- Some delegates: jpeg + png + tiff
./cross_compile/IMDelegataes/jpeg-8c/         <- jpeg-8c -- no need to patch it
./cross_compile/IMDelegataes/libpng-1.5.13    <- png lib -- no need to patch it
./cross_compile/IMDelegataes/tiff-4.0.3       <- tiff lib -- no need to patch it

./cross_compile/magick-config.h

If you don’t have this directory structure you can either create it or try change around the script. For some reason, magick-config.h does not show up correctly for me when I build the project, so the script looks for a valid copy of this file to use when building the project. You’ll need to grab a valid copy of this file for the version of ImageMagick that you are compiling. You can find the delegate libraries on the ImageMagick ftp

To run the script:

./imagemagick_compile.sh VERSION

where VERSION is the version of ImageMagick you want to compile (i.e.: 6.8.0-8, svn, …)

This script will compile ImageMagick as a static library to be included in iPhone projects
Support for:

  • png
  • jpeg
  • tiff

Upon successful compilation a folder called “IMPORT_ME” will be created from where you start the script: you can import it into your XCode project

XCode project settings

After including everything into XCode please also make sure to have these 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:

  • libxml2.dylib

Sample project

A more or less updated project is found in the IM_Test subfolder

You can’t perform that action at this time.