read function throws exception of Access violation.?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
mbatra
Posts: 18
Joined: 2012-05-29T08:37:10-07:00
Authentication code: 13

read function throws exception of Access violation.?

Post 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,
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: read function throws exception of Access violation.?

Post 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
mbatra
Posts: 18
Joined: 2012-05-29T08:37:10-07:00
Authentication code: 13

Re: read function throws exception of Access violation.?

Post 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,
Post Reply