protected override void ProcessRecord() { Bitmap img1 = ImageFunctions.Load(image1Source); Bitmap img2 = ImageFunctions.Load(image2Source); Bitmap result = null; if (operationType == "add" || operationType == "Add") { result = img1.ArithmeticBlend(img2, ImageFunctions.ColorCalculationType.Add); } if (operationType == "subtract" || operationType == "difference") { result = img1.ArithmeticBlend(img2, ImageFunctions.ColorCalculationType.Difference); } if (operationType == "average" || operationType == "avg") { result = img1.ArithmeticBlend(img2, ImageFunctions.ColorCalculationType.Average); } WriteObject(result); }
private void ApplyFilter(bool preview) { if (blendBitmap1 == null || blendBitmap2 == null || picPreview2.Image == null || picPreview1.Image == null) { return; } if (preview == true) { Bitmap blendPreview = (Bitmap)picPreview1.Image; picPreview.Image = blendPreview.ArithmeticBlend((Bitmap)picPreview2.Image, (ColorCalculator.ColorCalculationType)cmbBlendType.SelectedItem); } else { resultBitmap = blendBitmap1.ArithmeticBlend(blendBitmap2, (ColorCalculator.ColorCalculationType)cmbBlendType.SelectedItem); } }