ImageMagick 的几何系统需要在 implode 操作之前调用。MagickGetImageRegion将创建一个新图像进行内爆,MagickCompositeImage将应用子图像。一个示例c应用程序看起来像...
include <stdlib.h>
#include <stdio.h>
#include <wand/MagickWand.h>
int main ( int argc, const char ** argv)
{
MagickWandGenesis();
MagickWand * wand = NULL;
MagickWand * impl = NULL;
wand = NewMagickWand();
MagickReadImage(wand,"source.jpg");
// Extract a MBR (minimum bounding rectangle) of area to implode
impl = MagickGetImageRegion(wand, 200, 200, 200, 100);
if ( impl ) {
// Apply implode on sub image
MagickImplodeImage(impl, 0.6666);
// Place the sub-image on top of source
MagickCompositeImage(wand, impl, OverCompositeOp, 200, 100);
}
MagickWriteImage(wand, "output.jpg");
if(wand)wand = DestroyMagickWand(wand);
if(impl)impl = DestroyMagickWand(impl);
MagickWandTerminus();
return 0;
}