Page 1 of 1

Posted: 2006-05-29T06:29:58-07:00
by teetanne
Hi majlow,

well, to write a C++ prog. do it like this with VC++

Code: Select all

#include "stdafx.h"
#include <Magick++.h>

using namespace std;
using namespace Magick;

int _tmain(int argc, _TCHAR* argv[])
{
        cout << "crop a image" << endl;
	cout << "---------------------------------" << endl;
	int iRet = 0;
	Image image;
	Geometry frame;
        string fileName(argv[1]);    // todo: test argv[1] != null
	try {
		image.read(fileName);
		frame.width(100);
		frame.height(100);
		frame.xOff(50);
		frame.yOff(50);
		image.crop(frame);
		image.write(filename);
		iRet = 0;
	}
	catch(exception &error_) {
		cout << error_.what() << endl;
		iRet = 1;
        }
	catch(...) {
		cout << "Unknown exception occurred" << endl;
		iRet = 1;
        }
	return iRet;
}
When you move your exe file to a other computer you have to take all dlls from the imagemagick bin folder and put it in the same folder as the exe file. Your have to compile your prog. in release mode.
Compare http://redux.imagemagick.org/discussion ... php?t=3671


Thats it, nothing more.

Good luck, teetanne

Posted: 2006-06-08T03:22:27-07:00
by teetanne
Hi majlow,

download the "depends.exe" from MS an see what you program is missing.

teetanne