ClearImage .NET API
Crop(Int32,Int32,Int32,Int32) Method
Example 





Inlite.ClearImageNet Namespace > ImageEditor Class > Crop Method : Crop(Int32,Int32,Int32,Int32) Method
left edge of cropping rectangle
top edge of cropping rectangle
right edge of cropping rectangle
bottom edge of cropping rectangle
Crops image to specified rectangular area
Syntax
'Declaration
 
Public Overloads Sub Crop( _
   ByVal left As System.Integer, _
   ByVal top As System.Integer, _
   ByVal right As System.Integer, _
   ByVal bottom As System.Integer _
) 
'Usage
 
Dim instance As ImageEditor
Dim left As System.Integer
Dim top As System.Integer
Dim right As System.Integer
Dim bottom As System.Integer
 
instance.Crop(left, top, right, bottom)
public void Crop( 
   System.int left,
   System.int top,
   System.int right,
   System.int bottom
)
public procedure Crop( 
    left: System.Integer;
    top: System.Integer;
    right: System.Integer;
    bottom: System.Integer
); 
public function Crop( 
   left : System.int,
   top : System.int,
   right : System.int,
   bottom : System.int
);
public:
void Crop( 
   System.int left,
   System.int top,
   System.int right,
   System.int bottom
) 

Parameters

left
left edge of cropping rectangle
top
top edge of cropping rectangle
right
right edge of cropping rectangle
bottom
bottom edge of cropping rectangle
Remarks
Zone parameter does not apply
Example
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
    }
}
See Also

Reference

ImageEditor Class
ImageEditor Members
Overload List