Class MagicWandSettings
Nombre del espacio: Aspose.Imaging.MagicWand Asamblea: Aspose.Imaging.dll (25.4.0)
Una magia de la selección de los ajustes de clase.
public class MagicWandSettings
Inheritance
Miembros heredados
object.GetType() ,y, object.MemberwiseClone() ,y, object.ToString() ,y, object.Equals(object?) ,y, object.Equals(object?, object?) ,y, object.ReferenceEquals(object?, object?) ,y, object.GetHashCode()
Examples
El ejemplo muestra cómo seleccionar una simple área de una imagen basada en el tono y el color de cualquier pixel utilizando la herramienta 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
});
}
El ejemplo muestra cómo seleccionar una zona complicada de una imagen utilizando la herramienta Magic Wand y la capacidad de interactuar con las máscaras (invert, union, substrato).
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);
}
Constructors
MagicWandSettings(Point)
Inicia una nueva instancia de la clase Aspose.Imaging.MagicWand.MagicWandSettings.
public MagicWandSettings(Point point)
Parameters
point
Point
El punto de referencia.
MagicWandSettings(El int, int)
Inicia una nueva instancia de la clase Aspose.Imaging.MagicWand.MagicWandSettings.
public MagicWandSettings(int x, int y)
Parameters
x
int
La coordenada x del punto de referencia.
y
int
La coordenada y del punto de referencia.
Properties
AreaOfInterest
Obtenga o establece los límites de la zona para el trabajo del algoritmo.
public Rectangle AreaOfInterest { get; set; }
Valor de la propiedad
ColorCompareMode
Obtenga o establece el algoritmo de cómo se comparan los colores.
public ColorComparisonMode ColorCompareMode { get; set; }
Valor de la propiedad
ColorComparisonDelegate
Obtenga o establezca el algoritmo de comparación de colores personalizado si Aspose.Imaging.MagicWand.MagicWandSettings.ColorCompareMode se configura a Aspose.Imaging.MagicWand.ColorComparisonMode.Custom.
public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }
Valor de la propiedad
MagicWandSettings . ColorComparison
ContiguousMode
Obtenga o establece un valor que indique si el wand mágico sólo definirá píxeles contiguos.
public bool ContiguousMode { get; set; }
Valor de la propiedad
DirectionalMode
Obtenga o establece el modo de inundación rellenar el algoritmo de búsqueda: cuatro de ocho direcciones de búsqueda.
public FloodFillDirectionalMode DirectionalMode { get; set; }
Valor de la propiedad
Point
Obtenga o establece el punto de referencia para el trabajo del algoritmo.
public Point Point { get; }
Valor de la propiedad
Threshold
Obtenga o establece el nivel de tolerancia para la comparación de colores de píxeles.
public int Threshold { get; set; }