cloud goes social


computer, travel, movies, music, cuisine and more

ImageMagick, Xcode4, iOS4.3

Hi all!

Just a small update on the ImageMagick front! First of all, a reminder. All my ImageMagick related efforts (compiler script + test project) can be found over at github.

The latest ImageMagick, at the time of writing is version 6.6.8-5. I’ve bumped the versions of the delegate libraries, as well:

  • jpeg: 8-c
  • png: 1.4.5
  • tiff: 3.9.4

Finally I’ve got my hands on the latest Xcode4 and on the latest iOS4.3 SDK. I’ve updated the IM_Test Xcode project on the same git repository of the compiler script :)

You can always grab the pre-compiled versions from ImageMagick’s FTP stite

I hope everyone is happy about the update, if you are let me know what you’re up to with ImageMagick on the iPhone and if you feel like don’t hesitate in donating (link on the right), as you can see this blog runs ads-free and any bit helps!



Category: Code

Tagged: , ,

67 Responses

  1. chiranjibi says:

    Hi! Thanks for all of your work. I am running into trouble like i am trying to apply unsharp mask filter on image in iPad but it is not working. I tried Edge Detection also and it is working fine but USM is not.

    Please guide me….

  2. [...] 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 [...]

  3. Mario says:

    Hi C,

    Could you tell me if IM for IOS supports DNG to other format conversion?

    Thanks and great job!

  4. Bruce Cichowlas says:

    Hi! Thanks for all of your work. I am running into trouble linking with the current Xcode (4.5.1). I get the message below. Any ideas, anyone?

    ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/bcichowlas/Dropbox/git/e2/e2/libtiff.a for architecture armv7s

  5. Floix says:

    The current version is only compiled for armv7 architecture. Could u provide a binary that also runs on armv6?

  6. Floix says:

    Thanks for the work on ImageMagick for iOS. I’m facing a problem which i cannot solve right now. I’d like to add a small text to my image, using Arial als a font. Unfortunatly I receive the following error: delegate library support not built-in `/usr/local/share/ghostscript/fonts/n019003l.pfb’ (Freetype)

    I compiled freetype2 for iOS and added it to my project, but still there seems to be something i’m missing. Can you help me out here?

  7. Keyur says:

    I have some errors that I can’t seem to resolve. Any ideas of what might be going on?


    (LINE 9) CGImageRef ref = createStandardImage(img.CGImage);
    (LINE 10) UIImage * image = [self createPosterizeImage:ref];


    (LINE 9) Implicit declaration of function ‘createStandardImage’ is invalid in C99

    (LINE 9) Incompatible integer to pointer conversion initializing ‘CGImageRef’ (aka ‘struct CGImage *’) with an expression of type ‘int’;

    (LINE 10) No visible @interface for ‘ViewController’ declares the selector ‘createPosterizeImage:’

  8. Salil says:

    Does it have Ghostscript compiled in it as well? I can use GS API with it?

  9. mga says:

    I couldn’t make it compile on armv6 for the current latest IM (6.7.6-0). The error I received was:

    cp: /path/to/cross_compile/tmp_target/imagemagick/lib/libMagickCore.a: No such file or directory

    and similar errors like that so no ImageMagick got created. Delegates did get created, though.

    I (think I) managed to make it work on armv6 for 6.6.8-10 but with the latest JPG, PNG, TIFF delegates (armv7 works fine, waiting to test in my 3GS with OS 3.1.3).

    OS: 10.6.8
    XCode: 4.2
    iOS SDK: 5.0

    Thanks a lot!

  10. dinesh says:


    I am using libtiff to create tiff images. I am stuck how to convert TIFF data type to nsdata. I would really appreciate you can help me with this.


  11. eviljack says:


    Thanks for all the work. I was wondering if you knew of a way to change the temp file directory.

    ImageMagick generates a bunch of temp files in my app and it is getting a deny-file-write error. The program still finishes but I think it’s causing me some other problems with my app.
    I’ve tried doing a “putenv” but it seems IM doesn’t pick up on that. And I can’t put it in the configure.xml because I don’t know until runtime the actual path of the user’s directory I’m trying to write to.

  12. dinesh says:


    I am trying to using Image magick in my ipad project I could not find documentation of the classes. Can you please provide me any source for that.


  13. Dave says:

    Hey! I can’t thank you enough for making this available.

    I am getting memory leak according to Instruments. It’s in AcquireMagickMemory. Any thoughts?


  14. Steve says:

    Hey thanks a lot for the effort here. Getting a couple fatal errors when trying to deploy to an iPhone 4 with iOS 5.

    Undefined symbols for architecture armv7:
    “_j0″, referenced from:
    _FxEvaluateSubexpression in libMagickCore.a(magick_libMagickCore_la-fx.o)
    “_j1″, referenced from:
    _FxEvaluateSubexpression in libMagickCore.a(magick_libMagickCore_la-fx.o)
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Runs great in the simulator, of course. Any tips?

  15. Kiran says:

    Is there any support to open JPEG 2000 images with this iOS libraries, I tried to do so but it failed saying “No delegate decoder found for this format.”

  16. Andrew says:

    Hey Cloud thanks for your great work. I have compiled the libraries, but the size of *.a file is too large. What can I do for reducing the size? Compiled the libraries only for the arm arch When I distribute my app to app store?

  17. Lewis Denny says:

    Hey cloud :)

    This is exactly what Iv been looking for! I’m glad a mate tipped me off about using this, but how come you don’t distribute this in .deb format? Thanks for your time :)

  18. shawn says:

    Hey Cloud thanks for your work compiling ImageMagick for IOS and offering a sample project, it helps so much!

    I am trying to port a C++ program that uses the Magick++ library to iOS. I have tried importing the libMagick++.a into your xcode project and the source CPP files but I can’t get it to compile. I get an error that says the libMagick++.a was built for an unsupported file format which is not the architecture being linked (i386). So I know that I need to recompile the Magick++ library for i386, but even if I do this would it work? Or would it be better to rewrite the code to use the MagickCore or MagicWand commands instead?

    Thanks for your time!

    • Cloud says:

      It will work, you need to recompile it for: armv6, armv7 (for iPhone binaries) and i386x/x86_64 (should be the first, for the Simulator). You can reuse my script to understand how everything works!

      • shawn says:

        THANKS! I got it compiled as Universal and into a new Xcode project. Now I am trying to pass an image to it and I keep getting “Exception when loading image: Magick: NoDecodeDelegateForThisImageFormat” even though I can get the same image to read from compiling the program in the console. I am going to try to send raw pixel data instead and see if that works. Its a PNG image.

        Thanks again.

      • Cloud says:

        You need to compile it with some delegates for it to read PNG, JPEG, …

  19. eric says:

    Hey there, considering you’re compiling the libraries, would it be possible to get CLI binaries for iOS? Not for use with developing applications, for use with command line stuff on jailbroken devices. Please? The version currently on Cydia is too old.

  20. [...] have imagemagick running on the iPhone and can apply “MagickWand” methods with no problem. My issue is that I don’t [...]

  21. Wei says:


    many thanks for your efforts on doing this

    when I use this library,
    I got some strange results,

    I edit some code in the example code,
    I need two image to composite,

    when I use the jpeg compression one,
    it works well
    but if I don’t use the compression one
    it doesn’t work
    status = MagickTransformImageColorspace(magick_wand, GRAYColorspace);

    status = MagickNegateImage(magick_wand,MagickTrue);

    MagickAdaptiveThresholdImage(magick_wand, 5 ,5, 10);

    status = MagickCompositeImage(ori_magick_wand , magick_wand , CopyOpacityCompositeOp ,0,0);

    the first three call work well
    but the last one doesn’t work if I don’t read picture like MagickReadImageBlob in jpeg compression

    (in the without compression or new Method all dont work)

    because the compression is too slow
    I have to use other way

    any ideas?

    many thanks

  22. Tomek says:


    I try to compile imagemagick fro iphone but on last stage of compilation i got an error from lipo:

    [|- COMBINE (libMagickCore) armv7 armv6 i386]
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: specifed architecture type (i386) for file (/Users/tomaszsobkowiak/imagemagic/tmp_target/im_libs/libMagickCore.a.i386) does not match its cputype (12) and cpusubtype (6) (should be cputype (7) and cpusubtype (3))
    [|- COMBINE (libMagickWand) armv7 armv6 i386]
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: specifed architecture type (i386) for file (/Users/tomaszsobkowiak/imagemagic/tmp_target/im_libs/libMagickWand.a.i386) does not match its cputype (12) and cpusubtype (6) (should be cputype (7) and cpusubtype (3))

    And final libs are not creeated. What should I do with it?

    • Cloud says:

      it means that it didn’t manage to create the correct libraries before and lipo is failing. You may want to send me the log file that has been created in the same folder of the script so that I can look at it.


  23. Lifemoveson says:

    Is it possible to tile the main image and write it to a folder and use those tiles like PhotoScroller application?

  24. Lifemoveson says:

    Is there a way to tile the main image into various umages using iPhoneMagick on the fly ?

  25. jack says:

    MagickAnnotateImage not work,please check.thanks!!

    • Cloud says:

      I was tempted not to answer. Please if you have problems give detailed information on what is wrong. Anyway, it uses font rendering, which is not available on the iphone library as of today. Regards,


  26. Brendan says:

    Animated gif support would be awesome. Keep up the good work mate!

    • Cloud says:

      What exactly you mean with “support” they are inherently supported in IM. ~C

      • Brendan says:

        Guess I should look into it abit more before I make assumptions. Still getting to grips with IM. Would I be able to do gif saving/optimisation with the libraries you linked in your project?

        I know that the iPhone doesn’t support animated gifs natively but that there are ways around it:

        Trying to wrap my head around including IM in my projects, so your example will be most useful. Thanks!

      • Cloud says:

        It is definetely possible to have GIF support within IM. I have done it once. Cheers,


      • Brendan says:

        Oh what fun it is to be a designer with an idea… trying to code…. hehe :)

      • Brendan says:

        Just wondering, is there a way of linking imagemagick to your xcode project using macports?

      • Brendan says:

        Sorry for all my goofy comments – I’m looking through your older posts to try and get my head around what you’ve done. I see you *did* actually mention MacPorts in one of them.

      • Cloud says:

        Hi Brendan, no problems. I mentioned MacPorts as some dependencies to compile IM are not present by default on MacOSX.



      • Brendan says:

        You can download image magick with macports, where as all your examples are for downloading IM off the website.

        I put in the project build settings:
        Header Search Paths: /opt/local/include/ImageMagick/**
        Library Search Paths: /opt/local/lib/
        Other Linker Flags: -lMagickCore -lMagickWand -lz -lbz2 -ljpeg -lpng

        I then added the header files without copying them from
        /opt/local/include/ImageMagick/magick/ and
        /opt/local/include/ImageMagick/wand/ to my project.

        In build phases I added /opt/local/lib/libMagickCore.a and /opt/local/lib/libMagickWand.a to the ‘Link binaries with libraries’ section.

        My program is a really simple test:


        - (void)viewDidLoad
        [super viewDidLoad];
        NSLog(@”%s”, GetMagickVersion(nil));

        I get this:
        ld: warning: ignoring file /opt/local/lib/libMagickCore.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
        ld: warning: ignoring file /opt/local/lib/libMagickWand.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

        I’ve read that iOS doesn’t support .dylibs, so I’m guessing that’s why you use the .a files.

      • Cloud says:

        Download my Test project and you will see how it’s organized. There’s no reason to install IM from macports, just download the latest compiled one or compile one yourself using my script.

        But start with the example project (IM_Test).



      • Brendan says:

        Okiedokie, I’ll follow the master’s advice then. Thought I might have been being a little too clever for my own good. Learned some things in the process though. ;)

      • Brendan says:

        Good news! My little test program compiles!

        Two things:

        $(SRCROOT)/ (recursive) didn’t work, I got lots of errors along the lines of “Magick/MagickCore.h: No such file or directory” I had to change it to “$(SRCROOT)/” (recursive) as it is in your example project.

        OTHER_CFLAGS is already defined under the heading “LLVM GCC 4.2 Language” in Xcode 4′s build settings, so there’s no need to make a user defined one (it doesn’t let you). -DNS_BLOCK_ASSERTIONS=1 was already in the release section by default, so to be safe I left it in. (Your project doesn’t have it in there)

        Thanks a bunch. :)

      • Brendan says:


        I tried this in viewDidLoad:
        MagickWand *testMW = NewMagickWand();

        It gives me this error:
        Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
        pthread_mutexattr_destroy$UNIX2003 called from function AllocateSemaphoreInfo in image Gif Animator.
        If you are encountering this problem running a simulator binary within gdb, make sure you ‘set start-with-shell off’ first.

        As stated previously, NSLog(@”%s”, GetMagickVersion(nil)); works fine.

        Any ideas on what the problem is? Your example works fine for me. I’ve double checked and I’m pretty sure I followed your steps but it’s probably something I’ve done.

      • Brendan says:

        For the benefit others, the problem was that I was using an older version of IM. Make sure you download the newest version at the bottom of the page (I stupidly assumed it was at the top).

  27. Jon says:

    Have you considered doing the same for GraphicsMagick? It might give you better performance on the device…

    • Cloud says:

      I’ve looked briefly at graphics magick, as the main developer asked me and told me that compilation steps are fairly similar. I had encountered a few problems and I don’t have time nor resources to dedicate to that. If it is indeed similar it shouldn’t be a problem to take my compilation script and apply it. I couldn’t manage.

  28. Jochem Werner says:

    Cool, any love for Animated GIFs?

Leave a Reply


If you appreciate my work, my applications, this blog in general or you simply feel like rewarding me for something please consider donate.
Any amount will motivate me in keeping up with the blog and the applications.

Thank you!


F. Olsen, W. Chang, W. Edmondson, C. Sharff, M. Brown, G. Helton, J. de Ruiter, K. Langner, K. Smith, T. OHalloran, B. Zabarauskas

Listening to ...