ComposeImage: MagickCore/composite.c:559: CompositeImage: Assertion `image->signature == 0xabacadabUL' failed.
I'm suspicious that I have to cast (Image *) in the CompositeImage call and that leads me to belive I may be passing the wrong objects. And perhaps I should be using another API call instead.
Can anyone offer me some guidance?
Code: Select all
void test_wand(void)
{
MagickWand *mw = NULL;
PixelWand *c_wand = NULL;
DrawingWand *d_wand = NULL;
MagickWandGenesis();
/* Create a wand */
mw = NewMagickWand();
d_wand = NewDrawingWand();
c_wand = NewPixelWand();
// create a new canvas
PixelSetColor(c_wand,"white");
MagickNewImage(mw, 1000,1000, c_wand);
DrawSetStrokeOpacity(d_wand,1);
// Draw a line on the canvas
PixelSetColor(c_wand,"rgb(0,0,1)");
DrawSetFillColor(d_wand,c_wand);
DrawSetStrokeWidth(d_wand,3);
DrawLine(d_wand, 10, 10, 300, 300);
MagickDrawImage(mw,d_wand);
/* Read an external image */
MagickWand *mw2 = NewMagickWand();
MagickReadImage(mw2,"logo:");
CompositeOperator MyOp= OverCompositeOp;
CompositeImage((Image *) mw, MyOp, (Image *) mw2, 10, 10);
/* write it */
[quote][/quote]MagickWriteImage(mw,"logo.jpg");
/* Tidy up */
if(mw) mw = DestroyMagickWand(mw);
MagickWandTerminus();
}