compilation error

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
udayk82

compilation error

Post by udayk82 »

Hi Friends,
I am facing a problem in compiling and executing a c program which uses ImageMagick.h header file. It compiled without any error, but while executing the code i get the following error message..

Code: Select all

example1: coders/jpeg.c:679: ReadJPEGImage: Assertion `exception->signature == 0xabacadabUL' failed.
Aborted
To give complete information, the program is written just to check the utility of ImageMagick..

Code: Select all


Image *image;

      ImageInfo image_info;

      ExceptionInfo *exception;

      /*
        Initialize the image info structure and read an image.
      */
      GetImageInfo(&image_info);
      (void) strcpy(image_info.filename,"image.jpg");
      image=ReadImage(&image_info,exception);
      if (image == (Image *) NULL)
        exit(1);
Did anybody face this problem before??
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compilation error

Post by anthony »

It means the structure you gave to the IM library was NOT the structure it was expecting.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: compilation error

Post by el_supremo »

"exception" is an uninitialized pointer.
You can declare, initialize and use it like this:

Code: Select all

ExceptionInfo exception;

GetExceptionInfo(&exception);
image=ReadImage(&image_info,&exception);
Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: compilation error

Post by magick »

The newer preferred way to handle exceptions:
ExceptionInfo *exception;
exception=AcquireExceptionInfo();
image=ReadImage(ImageInfo,exception);
...
exception=DestroyExceptionInfo(exception);
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compilation error

Post by anthony »

That better be put in the architecture document.

Along with any changes to the whey a function should handle colors, and specifically
the CMYK black channel and alpha channel.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply