Code :
// ImageMagicConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int _tmain(int argc, _TCHAR* argv[])
{
InitializeMagick("E:\\ImageMagicConsole\\Debug");
// 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( "16022009294.jpg" );
// 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;
}
This example compiles well but when I run the application I get following Visual Studio
Just-In-Time Debugger Message:
An unhandled win32 exception occured in ImageMagicConsole.exe[2816].
Debugging at line " image.read( "16022009294.jpg" ); " shows message
Unhandled exception at 0x100216b5 in ImageMagicConsole.exe:
0xC0000005: Access violation writing location 0x0148bc46.