Hi,

I've just installed ImageMagick and am interested in using the C++ API. I'm
working on a small private research project and I'm interested in loading
for example JPEG files into memory, making some changes to the data and
saving the changed data to a file. However, I've not been successful in
loading a JPEG file into the memory yet.

Below please find the super-simple code trying to use the C++ interface. The
code compiles successfully, but when I run it I get the error: "Unhandled
exception at 0x73f1ab1a in Magick_Experiment.exe: 0xC0000005: Access
violation reading location 0xcccccccc." Does anyone has an idea what
is going wrong here? Any feedback will be greatly appreciated.

Also some background information:

- I'm using Visual C++ 2008 Express Edition under Windows Vista with SP1.
- Antwerp.JPG (used in the code) resides in the same location with the
executable.
- All DLLs that come with the ImageMagick installation reside in the same
location with the executable. Just to be sure I copied all the DLLs.


#include <iostream>
#include <string>

#include <Magick++.h>

using namespace std;
using namespace Magick;


int main(int /*argc*/, char ** argv)
{
  int retCode = 0;

  InitializeMagick(*argv);  // Taken from the examples

  string img("Antwerp.JPG");

  try {
    Image image;
    image.read(img);
  }
  catch( exception &error_ )
  {
    cout << "Caught exception: " << error_.what() << endl;
    retCode = 1;
  }

  return retCode;
}

Regards,

Ali
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to