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,
read function throws exception of Access violation.?
Re: read function throws exception of Access violation.?
Try this example (save as magick++.cpp):
Build with
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";
}
}
- g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
- convert logo: logo.jpg
./magick++
- gdb ./magick++
run
where
Re: read function throws exception of Access violation.?
magick wrote:Try this example (save as magick++.cpp):
Build withCode: 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"; } }
Now run:
- g++ `Magick++-config --cxxflags --cppflags` -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
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:
- convert logo: logo.jpg
./magick++
- 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,