1. 我下载的版本是 ImageMagick-7.0.8-12
2. cd ImageMagick-7.0.8-12
3. ./configure --enable-delegate-build --enable-static --disable-shared
4. make -j4
5. make install
这时会看到安装到了:
/usr/local/include/imageMagick-7/ //这里是头文件
/usr/local/lib/ //这里是库文件 libMagick++-7.Q16HDRI.a
6. xcode 里边
在 Header Search Paths 里增加
/usr/local/include/imageMagick-7
Library Search Paths 增加
/usr/local/lib
link Binary Width Libraries 把动态库拖放进去
libMagick++-7.Q16HDRI.a
用xcode 建立工程测一下吧
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
InitializeMagick(*argv);
// Construct the image object. Seperating image construction from the
// the read operation ensures that a failure to read the image file
// doesn't render the image object useless.
Image image;
try {
// Read a file into image object
image.read( "girl.gif" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(100,100, 100, 100) );
// Write the image to a file
image.write( "x.gif" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
成功了!!!