1. 程式人生 > >ImageMagick--VS2015環境配置、開發(registrykeylookupFailed)

ImageMagick--VS2015環境配置、開發(registrykeylookupFailed)

Title:
ImageMagick–VS2015環境配置、開發

生命不止,blog繼續。

ImageMagick–介紹》對ImageMagick進行了簡單的介紹,如今就看看如何在vs工程中使用。

新建一個控制檯工程(略)

然後配置工程:
1包含目錄
這裡寫圖片描述
2匯入lib
這裡寫圖片描述
3選擇MT
這裡寫圖片描述
測試程式碼:

#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("C:\\Users\\xueba\\Documents\\XueBa\\wangshubo\\00.JPG");*/ image.read("00.JPG"); cout << "image.columns()"
<< image.columns() << endl; cout << "image.size().width()" << image.size().width() << endl; cout << "image.size().height()" << image.size().height() << endl; image.resize(Geometry(1600, 900, 0, 0)); cout << "resize image.columns()"
<< image.columns() << endl; cout << "resize image.size().width()" << image.size().width() << endl; cout << "resize image.size().height()" << image.size().height() << endl; // Write the image to a file image.write("00.JPG"); } catch (Exception &error_) { cout << "Caught exception: " << error_.what() << endl; system("pause"); return 1; } system("pause"); return 0; }

錯誤1

Caught exception: test_image_magick.exe: unable to open image 'h応': No such file or directory @ error/blob.c/OpenBlob/2695

方案:
這個原因就是我們應該選擇MT,也就是選擇release:
Magick++ doesn’t like to run in Visual Studio’s Debug mode so you have to build as a Release or ImageMagick won’t be happy.

錯誤2
我們打了一個包,包含了所有需要的dll,興致勃勃的拿給使用者。結果在使用者的電腦上出現這個錯誤:
這裡寫圖片描述