The following examples demonstrate uses of ImageEditor class for the purpose of custom image processing operation. They can be combined with any image repair methods
Basic image modification | Copy Code |
---|---|
// Open image in Image editor ImageEditor editor = new ImageEditor(); editor.Image.Open(fileName, pageNumber); editor.RotateFlip(RotateFlipType.Rotate90FlipNone); // rotate 90 editor.RotateFlip(RotateFlipType.RotateNoneFlipXY); // rotate 180 if (editor.BitsPerPixel == 1) {editor.Fatten(1, MorphDirections.allNeighbors);} editor.Invert(); editor.Clear(); |
Modifying image's area-of-interest
A Zone is a rectangular area-of-interest on an image. By default the ImageEditor methods operate on the whole image.
To apply operations to a rectangular region of an image set the Zone property of ImageEditor. Then apply image processing methods. Several ImageEditor methods ignore a Zone setting. Check the ClearImageNet API Reference for specific details of each method.
Zone setting can be changed at any time.
Set Zone to new Rectangle() to return to default (entire image) setting.
Modifying image's area-of-interest | Copy Code |
---|---|
// Open image in Image editor ImageEditor editor = new ImageEditor(); editor.Image.Open(fileName, pageNumber); // Set zone on a page editor.Zone = new Rectangle(10, 10, 500, 400); // <==== SET ZONE editor.Clear(); editor.Zone = new Rectangle(); // <==== Remove ZONE Image |
Image analysis
Image analysis methods measure various image properties.
Image analysis | Copy Code |
---|---|
// Open image in Image editor ImageEditor tools = new ImageEditor(); tools.Image.Open(fileName, page); // Measure skew angle double dSkew = tools.SkewAngle; Console.WriteLine (string.Format("Skew {0:0.##} deg", dSkew)); // Iterate through image objects if (tools.BitsPerPixel == 1) { ImageObject[] objects = tools.GetObjects(); Console.WriteLine ("Object Count: {0}", objects.Length); foreach (ImageObject Obj in objects) { Console.WriteLine (" Pixels:" + Obj.Pixels.ToString() + " Intervals:" + Obj.Intervals.ToString()); Console.WriteLine (" ERect:" + Obj.Rectangle.Left.ToString() + ":" + Obj.Rectangle.Top.ToString() + "-" + Obj.Rectangle.Right.ToString() + ":" + Obj.Rectangle.Bottom.ToString()); } } |