Running IM C++ programs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply

Post by teetanne » 2006-05-29T06:29:58-07:00

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 {;
		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 ... php?t=3671

Thats it, nothing more.

Good luck, teetanne


Post by teetanne » 2006-06-08T03:22:27-07:00

Hi majlow,

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


Post Reply