The following examples demonstrate typical uses of ImageEditor class for the purpose of automatic production image processing:
Basic image repair | Copy Code |
---|---|
// Open image for repair ImageEditor repair = new ImageEditor(); repair.Image.Open(fileName, pageNumber); // Apply repair methods. For example: repair.AutoDeskew(); repair.AutoRotate(); repair.CleanNoise(3); // Save results repair.Image.SaveAs(fileOut, Inlite.ClearImage.EFileFormat.ciEXT); |
Repair multi-page image file using page iteration | Copy Code |
---|---|
// Open image for repair ImageEditor repair = new ImageEditor(); repair.Image.Open(fileName, 1); // Apply repair methods to each page for (int pageNumber = 1; pageNumber <= repair.Image.PageCount; pageNumber++) { repair.Image.Open(fileName, pageNumber); repair.AutoDeskew(); repair.AutoRotate(); repair.CleanNoise(3); // Save results repair.Image.Append(fileOut, Inlite.ClearImage.EFileFormat.ciEXT); } |
Repair multi-page image file using Edit method | Copy Code |
---|---|
private void _OnEditPage(object sender, EditPageEventArgs e) { e.Editor.AutoDeskew(); e.Editor.AutoRotate(); e.Editor.CleanNoise(3); // e.skipPage = true; // Set to true to skip this page in output file // e.cancel = true; // Set to true to ignore remaining pages } ... // Edit each page of fileName in _OnEditPage method. // Save each page to fileOut in specified format. Overwrite fileOut if exists ImageEditor repair = new ImageEditor(); repair.Edit(fileName, _OnEditPage, fileOut, ImageFileFormat.tiff, true); |
NOTE: Image modification and repair methods can be intermixed with image analysis methods to modify images in more flexible and sophisticated ways.