int magickMotionBlurImage(const char *imageFile, const char *outputImage, double radius, double sigma, double angle){ MagickBooleanType status; MagickWand *magick_wand; /* Read an image. */ MagickWandGenesis(); magick_wand=NewMagickWand(); status=MagickReadImage(magick_wand, (char *)imageFile); if (status == MagickFalse){ ThrowWandException(magick_wand); } /* Turn the images into a thumbnail sequence. */ MagickResetIterator(magick_wand); while (MagickNextImage(magick_wand) != MagickFalse) MagickMotionBlurImage(magick_wand, radius, sigma, angle); /* Write the image then destroy it. */ status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue); if (status == MagickFalse) ThrowWandException(magick_wand); magick_wand=DestroyMagickWand(magick_wand); MagickWandTerminus(); return status; }
MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand, const ChannelType channel,const double radius,const double sigma, const double angle) { MagickBooleanType status; ChannelType previous_channel_mask; if (channel != UndefinedChannel) { previous_channel_mask = MagickSetImageChannelMask(wand, channel); } status = MagickMotionBlurImage(wand, radius, sigma,angle); if (channel != UndefinedChannel) { (void) MagickSetImageChannelMask(wand, previous_channel_mask); } return status; }