Page 1 of 1

read and write image

Posted: 2009-06-29T13:34:19-07:00
by msp
I am trying to run the sample code to read and write an image. Following is the code. I have installed Magick++ on my machine and still it is giving some errors which i am not able to figure out. It says magick/magick_config.h not declared. Also gives same error for all different header files. Does it because I have stored them in wrong location? or do i have to include them in the following code? Please help me.

#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **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;
}

Re: read and write image

Posted: 2009-06-29T18:07:03-07:00
by anthony
Was the header files installed? Do you have the right -I include flag to find the header files?