How to C#: Cleanup Images
Overview for How to Cleanup Images
Related .net document control helps:
asp.net tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net document viewer:
EdgeDoc:ASP.NET Document Viewer C# Control:
Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net edit pdf text:
ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
Overview
By using the XImage.Raster SDK, you can cleanup image by assigning to the processor.
best asp.net pdf library,
itextsharp insert image into pdf vb.net,
ghostscript pdf to tiff c#,
find and replace text in pdf using c#,
vb.net open pdf in webbrowser,
c# merge multi page tiff.
The related propertied and methods are as follows.
Binarize
It may be useful to convert an image to 1bpp for facilitate cleanup image or image recognition. By setting the BinarizeThreshold property whose value range is 0 to 255, it will permanently modify the image to 1bpp grayscale image of the same dimensions. While, the BinarizeLceFactor property will control the image's contrast.
vb.net open pdf in webbrowser,
convert csv to pdf c# itextsharp,
vb.net excel to pdf converter,
open source library to print pdf c#,
c# pdf crop,
c# pdf to png,
vb.net ocr pdf free.
Deskew
Removes skew from the image. Skew is an artifact that occurs in scanned images because of the camera being misaligned, imperfections in the scanning or surface, or simply because the paper was not placed completely flat when scanned, adjust the rotation of the image, usually pass 0.4 to the DeskewImage method will get a best result. Rotation angle can be obtained from the RotationAngle property.
asp.net open excel file,
how to upload pdf file in database using asp.net c#,
mvc show pdf in div,
asp.net edit pdf,
asp.net preview pdf,
asp.net display image,
asp.net tiff viewer.
Shear
Unlike the Deskew method to adjust the rotation of the body of the image, the Shear method can adjust the text body of the image.
Removespecks
Reduce speckle noise
Detect Blank Pages
To identify blank page through the property BlankPageDetected, if there is a blank page, value true will be returned, otherwise value false will be returned.
Delete Blank Pages
Set property BlankPageDelete to true , blank pages in the document will be deleted.
Remove Edges or Borders
Automatically remove the borders of an image.
Steps to Cleanup Image
Load an image with RasterImage object.
Create an image processor with ImageProcess object.
Call the responding method of ImageProcess object to complete the task flopping image.
Save the modified image to an image file on the disk.
In order to acheive the work, please refer to the following steps.
Install XImage.Raster in C# Project
Add necessary references to your C#.NET project. Right-click the project and select "Add Reference..." to locate and add the following DLLs as project references;
RasterEdge.Imaging.Basic.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XImage.Raster.dll
Use corresponding namespaces;
using RasterEdge.XImage.Raster;
Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:
If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.
If using x86, the platform target should be x86.
C# Demo Code to Cleanup Images
Sample Code (modify BinarizeThreshold):
RasterImage img = new RasterImage(@"C:\input.png");
ImageProcess process = new ImageProcess(img);
//Convert 24bpp image input.png to 1bpp, the pixel value below 150 will be set to 0,and above 150 will be set to 1.
process.BinarizeThreshold = 150;
img.Save(@"C:\output.png");
|
Sample Code (Deskew Image):
RasterImage img = new RasterImage(@"C:\input.png");
ImageProcess process = new ImageProcess(img);
//Deskew image, adjust the rotation angle of the image. Usually pass 0.4 to this method will get a best result.
process.DeskewImage(0.4);
img.Save(@"C:\output.png")
|
Sample Code (Shear Image):
RasterImage img = new RasterImage(@"F:\input.tif");
ImageProcess process = new ImageProcess(img);
//Shear image, set the x shear angle to 20, and y shear angle to 30.
process.ShearImage(20, 30);
//only shear the second page of the input tif.
process.ShearImage(20, 30, 1);
img.Save(@"C:\output.tif");
|
Sample Code (detect blank page):
RasterImage img = new RasterImage(@"F:\input.tif");
ImageProcess process = new ImageProcess(img);
//If there is a blank page in the input.tif the value true will be returned , otherwise will return false.
bool haveBlankPages = process.BlankPageDetected;
|
Sample Code (delete blank page):
RasterImage img = new RasterImage(@"C:\input.tif");
ImageProcess process = new ImageProcess(img);
//If there are blank pages in the input.tif, they will be removed form the input.tif.
process.BlankPageDelete = true;
img.Save(@"C:\output.tif");
|