void ImageMethods(string imageFile, string imageFileOut)
{
ImageEditor editor = new ImageEditor();
ImageEditor editorCenter = new ImageEditor();
try
{
// Open image file
editor.Image.Open(imageFile, 1);
// Crop area of the image
editor.Crop(100, 200, 800, 1000);
// Convert to grayscale
editor.ToGrayscale();
// Create a zone in the upper left corner
editor.Zone = new System.Drawing.Rectangle(0, 0, editor.Width / 2, editor.Height / 2);
// Invert center area of the image
editor.Clear();
// Create a zone in the center of the image
editor.Zone = new System.Drawing.Rectangle(editor.Width / 3, editor.Height / 3, editor.Width / 3, editor.Height / 3);
// Invert center area of the image
editor.Invert();
// Duplicate center area to a new image
editorCenter.Copy(editor);
// Convert image to bi-tonal
editorCenter.ToBitonal();
// Remove zone from the editor image
editor.Zone = new System.Drawing.Rectangle();
// Save processed image
editor.Image.SaveAs(imageFileOut, Inlite.ClearImage.EFileFormat.ciEXT);
}
catch (ClearImageException ex)
{ Console.WriteLine(ex.Message); }
finally
{
editor.Dispose(); editorCenter.Dispose(); // ClearImage V9 and later
}
}