Discussion:
Problem with ReadImage() --> Assertion in CloneStringInfo()
Tabor Kelly
2011-06-27 15:22:56 UTC
Permalink
Hello, I am new to MagickCore. I am just trying to read an image in. I
wrote simple a program to demonstrate a problem that I am having in a
more complex program. It is very simple, I am not sure what I am doing
wrong. I am attempting to read temp.jpg from the current working
directory. However, when I do I get the following output:

a.out: magick/string.c:261: CloneStringInfo: Assertion
`string_info->signature == 0xabacadabUL' failed.

This is on Ubuntu 10.04 with (I believe) ImageMagick 6.5.7-8 if that
makes a difference. Here is the source to my demo program in its
entirety:

// C/C++ includes
#include <cstring>

// ImageMagick include
#include "magick/MagickCore.h"

int main (int argc, char **argv)
{
Image * pImage;
ImageInfo imageInfo;
ExceptionInfo exceptionInfo;

imageInfo.signature = MagickSignature;
strncpy(imageInfo.filename, "temp.jpg", MaxTextExtent);
pImage = ReadImage(&imageInfo, &exceptionInfo);

return EXIT_SUCCESS;
}

Any help would be greatly appreciated.

Thanks,

Tabor
Tabor Kelly
2011-06-27 16:40:59 UTC
Permalink
Post by Tabor Kelly
Hello, I am new to MagickCore. I am just trying to read an image in. I
wrote simple a program to demonstrate a problem that I am having in a
more complex program. It is very simple, I am not sure what I am doing
wrong. I am attempting to read temp.jpg from the current working
a.out: magick/string.c:261: CloneStringInfo: Assertion
`string_info->signature == 0xabacadabUL' failed.
This is on Ubuntu 10.04 with (I believe) ImageMagick 6.5.7-8 if that
makes a difference. Here is the source to my demo program in its
// C/C++ includes
#include <cstring>
// ImageMagick include
#include "magick/MagickCore.h"
int main (int argc, char **argv)
{
   Image * pImage;
   ImageInfo imageInfo;
   ExceptionInfo exceptionInfo;
   imageInfo.signature = MagickSignature;
   strncpy(imageInfo.filename, "temp.jpg", MaxTextExtent);
   pImage = ReadImage(&imageInfo, &exceptionInfo);
   return EXIT_SUCCESS;
}
Any help would be greatly appreciated.
Thanks,
Tabor
Well, I feel like and idiot because I didn't memset() imageInfo and
exceptionInfo to 0. However, now that I am I am getting the following
error:

coders/jpeg.c:952: ReadJPEGImage: Assertion `exception->signature ==
0xabacadabUL' failed.

I have also upgraded to ImageMagick 6.7.0-9.

-Tabor
d***@imagemagick.org
2011-06-27 17:12:21 UTC
Permalink
Post by Tabor Kelly
ImageInfo imageInfo;
ExceptionInfo exceptionInfo;
Use pointers instead (e.g. ImageInfo *imageInfo) and initialize with these
methods:

exceptionInfo=AcquireExceptionInfo();
imageInfo=CloneImageInfo((ImageInfo *) NULL);
Tabor Kelly
2011-06-27 17:54:25 UTC
Permalink
On Mon, Jun 27, 2011 at 10:12 AM,
Post by d***@imagemagick.org
Post by Tabor Kelly
ImageInfo imageInfo;
ExceptionInfo exceptionInfo;
Use pointers instead (e.g. ImageInfo *imageInfo) and initialize with these
   exceptionInfo=AcquireExceptionInfo();
   imageInfo=CloneImageInfo((ImageInfo *) NULL);
That did it. Thank You!

-Tabor

Loading...