Class MagicWandTool

Class MagicWandTool

名称: Aspose.Imaging.MagicWand アセンション: Aspose.Imaging.dll (25.4.0)

マジックバンドアルゴリズムのクラスは主な論理です。

public class MagicWandTool : IPartialArgb32PixelLoader

Inheritance

object MagicWandTool

Implements

IPartialArgb32PixelLoader

相続人

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

例では、Magic Wandツールを使用して、画像のトーンとピクセルの色に基づいて画像の単純な領域を選択する方法を示しています。

var imageFilePath = "input.png"; 
                                                                                                                                using (RasterImage image = (RasterImage)Image.Load(inputFilePath))
                                                                                                                                {
                                                                                                                                    // Create a new mask using magic wand tool based on tone and color of pixel (120, 100) with custom threshold equal to 150
                                                                                                                                    MagicWandTool
                                                                                                                                        .Select(image, new MagicWandSettings(120, 100) { Threshold = 150 })
                                                                                                                                        // Apply mask to the image
                                                                                                                                        .Apply();

                                                                                                                                    // Save image with forced transparency color type option
                                                                                                                                    image.Save(outputFilePath, new ImageOptions.PngOptions()
                                                                                                                                    {
                                                                                                                                        ColorType = PngColorType.TruecolorWithAlpha
                                                                                                                                    });
                                                                                                                                }

例では、Magic Wandツールを使用して画像の複雑な領域を選択し、マスク(インバート、ユニオン、サブストラクト)と相互作用する能力を示しています。

var imageFilePath = "input.png"; 
                                                                                                                                                                  using (RasterImage image = (RasterImage)Image.Load(inputFilePath))
                                                                                                                                                                  {
                                                                                                                                                                      // Create a new mask using magic wand tool based on tone and color of pixel (845, 128)
                                                                                                                                                                      MagicWandTool.Select(image, new MagicWandSettings(845, 128))
                                                                                                                                                                          // Union the existing mask with the specified one created by magic wand tool
                                                                                                                                                                          .Union(new MagicWandSettings(416, 387))
                                                                                                                                                                          // Invert the existing mask
                                                                                                                                                                          .Invert()
                                                                                                                                                                          // Subtract the specified mask created by magic wand tool with specified threshold from the existing one 
                                                                                                                                                                          .Subtract(new MagicWandSettings(1482, 346) { Threshold = 69 })
                                                                                                                                                                          // Subtract four specified rectangle masks from the existing mask one by one
                                                                                                                                                                          .Subtract(new RectangleMask(0, 0, 800, 150))
                                                                                                                                                                          .Subtract(new RectangleMask(0, 380, 600, 220))
                                                                                                                                                                          .Subtract(new RectangleMask(930, 520, 110, 40))
                                                                                                                                                                          .Subtract(new RectangleMask(1370, 400, 120, 200))
                                                                                                                                                                          // Feather mask with specified settings
                                                                                                                                                                          .GetFeathered(new FeatheringSettings() { Size = 3 })
                                                                                                                                                                          // Apply mask to the image
                                                                                                                                                                          .Apply();

                                                                                                                                                                      // Save image
                                                                                                                                                                      image.Save(outputFilePath);
                                                                                                                                                                  }

Methods

Process(レクサンダー、 int( ), ポイント、ポイント)

充電されたピクセルを処理します。

public void Process(Rectangle pixelsRectangle, int[] pixels, Point start, Point end)

Parameters

pixelsRectangle Rectangle

ピクセルは直角。

pixels int ( )

32ビット ARGB ピクセル

start Point

最初のピクセルポイント. 同じでない場合(左、トップ)は、それは私たちが持っている完全な直角ではないことを意味します。

end Point

最後のピクセルポイント. 同じでない場合(右、下)は、それは私たちが持っている完全な直角ではないことを意味します。

Select(ラスターイメージ、MagicWandSettings)

新しい Aspose.Imaging.MagicWand.ImageMasks.ImageBitMask を Aspose.Imaging.MagicWand.MagicWandSettings とソース Aspose.Imaging.RasterImage に基づいて作成します。

public static ImageBitMask Select(RasterImage source, MagicWandSettings settings)

Parameters

source RasterImage

アルゴリズムが動作するためのラスター画像。

settings MagicWandSettings

マスクを作成するために使用されるマジックバンドアルゴリズムの設定。

Returns

ImageBitMask

新しい Aspose.Imaging.MagicWand.ImageMasks.ImageBitMask.

 日本語