0

画像内の領域を内破する機能を実装しようとしています。iOS アプリケーション内で MagickWand を使用していますが、MagickWand API を使用して、内破したい画像の領域を (x 座標と y 座標で) 指定できません。内破はパラメータとして半径のみを使用しているようで、内破操作の基準点として画像の中心を使用しているようです。

現在、私はやっています:

MagickImplodeImage(self->wand,-1.0);
MagickWandGenesis();
self->wand = NewMagickWand();

誰もこれを行った経験がありますか? また、iOS 向けに推奨する他の画像処理ライブラリはありますか?

4

1 に答える 1

0

ImageMagick のGeometryシステムは、implode 操作の前に呼び出す必要があります。MagickGetImageRegionは内破する新しいイメージを作成し、MagickCompositeImageはサブイメージを元に適用します。アプリケーションの例は次のようになります...

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;
}
于 2015-01-17T22:09:25.777 に答える