title: ImageMagick in App bundle
body: <p>I found <a href="https://stackoverflow.com/questions/4773768/bundle-imagemagick-library-with-os-x-app">question (link)</a> witch is very similar to my problem. And the code in the <a href="https://stackoverflow.com/a/4792558/1428622">answer</a> looks to be something I've been looking for for long time:</p>
  
  <pre><code>-(id)init
  {
      if ([super init])
      {
          NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
          NSString* imageMagickPath = [bundlePath stringByAppendingPathComponent:@"/Contents/Resources/ImageMagick"];
          NSString* imageMagickLibraryPath = [imageMagickPath stringByAppendingPathComponent:@"/lib"];
  
          MAGICK_HOME = imageMagickPath;
          DYLD_LIBRARY_PATH = imageMagickLibraryPath;
      }
      return self;
  }
  
  -(void)composite
  {
      NSTask *task = [[NSTask alloc] init];
  
      // the ImageMagick library needs these two environment variables.
      NSMutableDictionary* environment = [[NSMutableDictionary alloc] init];
      [environment setValue:MAGICK_HOME forKey:@"MAGICK_HOME"];
      [environment setValue:DYLD_LIBRARY_PATH forKey:@"DYLD_LIBRARY_PATH"];
  
      // helper function from
      // http://www.karelia.com/cocoa_legacy/Foundation_Categories/NSFileManager__Get_.m
      NSString* pwd = [Helpers pathFromUserLibraryPath:@"MyApp"];
  
      // executable binary path
      NSString* exe = [MAGICK_HOME stringByAppendingPathComponent:@"/bin/composite"];
  
      [task setEnvironment:environment];
      [task setCurrentDirectoryPath:pwd]; // pwd
      [task setLaunchPath:exe]; // the path to composite binary
      // these are just example arguments
      [task setArguments:[NSArray arrayWithObjects: @"-gravity", @"center", @"stupid hat.png", @"IDR663.gif", @"bla.png", nil]];
      [task launch];
      [task waitUntilExit];
  }
  </code></pre>
  
  <p>But when I try to use it I am having 6 errors:</p>
  
  <pre><code>Use of undeclared identifier 'MAGICK_HOME'
  Use of undeclared identifier 'DYLD_LIBRARY_PATH'
  Use of undeclared identifier 'MAGICK_HOME'
  Use of undeclared identifier 'DYLD_LIBRARY_PATH'
  Use of undeclared identifier 'Helpers'
  Use of undeclared identifier 'MAGICK_HOME'
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/6MKJM.png" alt="enter image description here"></p>
  
  <p>How could I fix it?</p>