NOTE: This KB article contains somewhat outdated examples. DotImage has a BlankPageDetectionCommand which is a bit more "intelligent" about its detection. This article is being maintained as the methods described are still useful in some cases.
If you ever need to detect blank pages, you can use the GetDocumentHistogram method from the Histogram class. Here is an example that's specific to our DotTwain Acquisition classes ImageAcquired event.
private void OnImageAcquired(object sender, AcquireEventArgs e)
if (e.Image != null)
// Convert to an AtalaImage. (assuming you are using DotTwain)
AtalaImage img = AtalaImage.FromBitmap(e.Image);
// We need a 1-bit image.
AtalaImage tmp = img.GetChangedPixelFormat(PixelFormat.Pixel1bppIndexed);
// Check for separator.
Histogram hist = new Histogram(tmp);
int doc = hist.GetDocumentHistogram();
float tolerance = (doc + doc) * 0.005f;
// If black is greater than the tolerance, it's a real page.
if (doc > tolerance)
// Save the page.
Private Sub OnImageAcquired(ByVal sender As Object, ByVal e As AcquireEventArgs) Handles Twain.ImageAcquired
If Not e.Image Is Nothing Then
' Convert to an AtalaImage. (assuming you are using DotTwain)
Dim img As AtalaImage = AtalaImage.FromBitmap(e.Image)
' We need a 1-bit image.
Dim tmp As AtalaImage = img.GetChangedPixelFormat(PixelFormat.Pixel1bppIndexed) img.Dispose()
' Check for separator.
Dim hist As Histogram = New Histogram(tmp)
Dim doc() As Integer = hist.GetDocumentHistogram()
Dim tolerance As single = (doc(0) + doc(1)) * 0.005f
' If black is greater than the tolerance, it's a real page.
If doc(1) > tolerance Then
' Save the page.
If you find some pages which are not blank are being detected as blank, you can decrease the percentage used to calculate the tolerance.