Processing command features
In This Topic
Process multiple images using the same image processing command
The same image processing command can be applied to multiple images.
Here is C#/VB.NET code that shows how to create an image processing command and apply it to 3 images:
Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand command =
new Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness);
command.ExecuteInPlace(image1);
command.ExecuteInPlace(image2);
command.ExecuteInPlace(image3);
Dim command As New Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness)
command.ExecuteInPlace(image1)
command.ExecuteInPlace(image2)
command.ExecuteInPlace(image3)
Proces image region
The image processing command, which is derived from
ProcessingCommandWithRegion class, has the
ProcessingCommandWithRegion.RegionOfInterest property and can be applied not only to the specified image region.
Here is C#/VB.NET code that shows how to change brighntess in image region:
Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand command =
new Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness);
command.RegionOfInterest = new Vintasoft.Imaging.RegionOfInterest(selectedArea);
command.ExecuteInPlace(image);
Dim command As New Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness)
command.RegionOfInterest = New Vintasoft.Imaging.RegionOfInterest(selectedArea)
command.ExecuteInPlace(image)
Monitor image processing progress
The image processing progress can be monitored using the
ProcessingCommandBase.Started,
ProcessingCommandBase.Progress,
ProcessingCommandBase.Canceled and
ProcessingCommandBase.Finished events. The
ProcessingCommandBase.Started and
ProcessingCommandBase.Progress events allows to stop the image processing.
Here is C#/VB.NET code that shows how to display the image processing progress:
public void ChangeBrightnessWithProgress()
{
Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand command =
new Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness);
command.Progress +=
new System.EventHandler<Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs>(command_Progress);
command.ExecuteInPlace(image);
}
private void command_Progress(object sender, Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs e)
{
System.Console.WriteLine(e.Progress);
e.Cancel = true;
}
Public Sub ChangeBrightnessWithProgress()
Dim command As New Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand(Brightness)
AddHandler command.Progress, New System.EventHandler(Of Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)(AddressOf command_Progress)
command.ExecuteInPlace(image)
End Sub
Private Sub command_Progress(sender As Object, e As Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)
System.Console.WriteLine(e.Progress)
e.Cancel = True
End Sub
Process the source image or create the source image clone before image procesing
ProcessingCommandBase.ExecuteInPlace method processes the source image, i.e. does the "in-place" image processing.
ProcessingCommandBase.Execute method creates the source image clone, processes cloned image and returns cloned image.
Create custom image processing commands
ProcessingCommandBase is the base class for all image processing commands. The custom image processing command can be created from scratch or by extending any existing processing command.