Problem with MagickAverageImages

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
edsonlp1
Posts: 7
Joined: 2011-06-06T02:50:18-07:00
Authentication code: 8675308

Problem with MagickAverageImages

Post by edsonlp1 »

Hello!

I'm trying to make an average of a set of images with the function MagickAverageImages, but i'm doing something wrong..

Code: Select all

MagickWand *mw = NULL;
	MagickWand *imagen =NULL;
	MagickWand *combi =NULL;
	MagickBooleanType status;

	MagickWandGenesis();

        mw = NewMagickWand();
	imagen =NewMagickWand();
	combi =NewMagickWand();

	/* Read the input image */
	MagickReadImage(mw,"C:\\data\\10_3_61_154\\000\\004\\M00001.jpg");
	MagickReadImage(imagen,"C:\\data\\10_3_61_154\\000\\004\\M00001.jpg");


	status= MagickAddImage (mw, imagen);
	combi = MagickAverageImages(mw);
		
	/* write it */
	MagickWriteImage(combi,"D:\\c++\\imagemagick\\Debug\\combinacion.jpg");

	/* Tidy up */
	if(mw) mw = DestroyMagickWand(mw);
	if(imagen) imagen = DestroyMagickWand(imagen);
	if(combi) combi = DestroyMagickWand(combi);

	MagickWandTerminus();
}
        
What i'm doing wrong? Thanks a lot!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem with MagickAverageImages

Post by magick »

You need to check for exceptions. See http://www.imagemagick.org/script/magick-wand.php and look for ThrowWandException().
Post Reply