我正在尝试实现在图像中内爆区域的功能。我在iOS应用程序中使用iOS,但通过MagickWand API,我无法指定要内爆的图像区域(通过x和y坐标)。内爆似乎只以半径作为参数,并且似乎使用图像的中心作为内爆操作的参考点。
目前,我正在做:
MagickImplodeImage(self->wand,-1.0);
MagickWandGenesis();
self->wand = NewMagickWand();有人有这样做的经验吗?另外,还有其他的图像处理库可以推荐给iOS吗?
发布于 2015-01-17 22:09:25
ImageMagick的几何学系统需要在内爆操作之前调用。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;
}https://stackoverflow.com/questions/21953891
复制相似问题