Page 1 of 1

read function throws exception of Access violation.?

Posted: 2012-07-31T04:43:30-07:00
by mbatra
Hi,

I am using Magick++ to rotate an image. I have initialized the ImageMagick library also. WHen I am reading an image using read function, it throws an exception 'Access violation writing to memory location .....'.

Anybody , have any idea about this.?



Regards,

Re: read function throws exception of Access violation.?

Posted: 2012-07-31T05:39:17-07:00
by magick
Try this example (save as magick++.cpp):

Code: Select all

#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main() {
  try {
    Image sourceImage("logo.jpg");
    Image newImage(sourceImage);
    newImage.zoom("50x");
    newImage.write("newlogo.jpg");
  } catch (Error &exception) {
    cerr << exception.what() << '\n';
  } catch (...) {
    cerr << "Unknown exception thrown\n";
  }
}
Build with
  • g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
Now run:
  • convert logo: logo.jpg
    ./magick++
If that fails, try with the latest release of ImageMagick, 6.7.8-7 @ http://www.imagemagick.org/download/. If that also fails, get a stack trace and post it here:
  • gdb ./magick++
    run
    where

Re: read function throws exception of Access violation.?

Posted: 2012-07-31T05:50:19-07:00
by mbatra
magick wrote:Try this example (save as magick++.cpp):

Code: Select all

#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main() {
  try {
    Image sourceImage("logo.jpg");
    Image newImage(sourceImage);
    newImage.zoom("50x");
    newImage.write("newlogo.jpg");
  } catch (Error &exception) {
    cerr << exception.what() << '\n';
  } catch (...) {
    cerr << "Unknown exception thrown\n";
  }
}
Build with
  • g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
Now run:
  • convert logo: logo.jpg
    ./magick++
If that fails, try with the latest release of ImageMagick, 6.7.8-7 @ http://www.imagemagick.org/download/. If that also fails, get a stack trace and post it here:
  • gdb ./magick++
    run
    where


Hi,

Thanx for the reply.
I am using windows operating system and VS2010 IDE. This throws the same exception at the first line in try block.

Image sourceImage("logo.jpg");

Image exists in the specified path.


Regards,