Page 1 of 1

Error while retrieving image's width / height

Posted: 2008-06-30T11:48:16-07:00
by Clem
Hello,

I only need imagemagick to load/save image files.

The annoying code snippet is simple :

Code: Select all

Magick::Image tmpImage;
try
{
    tmpImage.read (path);
    unsigned int width = tmpImage.columns();
    ...
Everything compiles well, but at the execution i've got this message :

Unhandled exception at 0x7c342eee in xxx.exe: 0xC0000005: Access violation reading location 0xcccccccc.

Then i have tried in an other way :

Code: Select all

Magick::Image tmpImage;
try
{
    tmpImage.read (path);
    Magick::Geometry tmpImageGeometry = tmpImage.size();
    unsigned int width = tmpImageGeometry.width();
    ...
But that doesn't change anything, the error message is still popped...

The geometry seems not to be well set at image loading, the behavior is like dealing with an uninitialized pointer.

Any idea please, i've spent all the day on this !
(I have also tried to use magick++ through the "cool image" library : the problem is still present but apprears a little bit before : during construction "Magick::Image image(filename);" at line 26812 in CImg.h)

Re: Error while retrieving image's width / height

Posted: 2008-06-30T13:00:15-07:00
by magick
Have you tried the demo workspaces provided with the ImageMagick binary distribution? Go to c:\Program Files\ImageMagick-6.4.2-Q16\Magick++_Demos and select the button workspace. Build the workspace and start it. Does it run to completion without complaint? If so, substitute your code snippet in the button workspace and build and run. Sometimes we get reports about errors like the one you posted that is simply due to not setting up the compile parameters properly.

Re: Error while retrieving image's width / height

Posted: 2008-07-01T02:56:19-07:00
by Clem
Hi, thank you for your attention.

The "button" project compiles with warning (since i use the dll version of magick++ and it uses stl classes (such as "std::_Container_base_aux") as base class, which haven't got dll interface). But the demo runs properly.

So i have copied the settings in my own project, it compiles but doesn't work ! The program now crashes at "tmpImage.read (path);" with the same error message.

- Are there any known issues by using magick in a dll (my project is a dll, not an executable) ?
- Perhaps i must use the static version of the magick library but that's annoying since i project to reuse it in the next dll i have to develop for my soft.

i'm lost...

Re: Error while retrieving image's width / height

Posted: 2008-07-08T09:21:27-07:00
by rawsonl
Did you ever figure this out?