public override void Apply(MagickImage image) { if (Radius == 0 && Threshold == 0) { return; } var mask = (MagickImage)image.Clone(); mask.ColorSpace = ColorSpace.Gray; mask.ReduceNoise(10); mask.Threshold(new Percentage(Threshold)); // mask.Sharpen(); // mask.Blur(5, 5); mask.Negate(); mask.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "Mask.png")); image.SetWriteMask(mask); image.Blur(0, Radius); image.RemoveWriteMask(); // Debug.Log(Path.Combine(Paths.ResourcesPath(Engine.Engine.project))); image.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "custom.png")); // var clone = image.Clone(); // clone.SelectiveBlur(0, Radius, new Percentage(Threshold)); // clone.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "selective.png")); }
public MainWindow() { var root = Paths.AppDataDirectory(); Loaded += OnLoaded; DataContext = this; LoadApplicationSettings(); InitializeComponent(); WindowStartupLocation = WindowStartupLocation.Manual; Left = settings.x; Top = settings.y; Height = settings.height; Width = settings.width; }