This project has moved. For the latest updates, please go here.

Detecting empty pages in scanned Tiff

Apr 14, 2016 at 12:06 AM
Hi,

Is there a way to detect if an image is empty ?

I am processing some scanned images and must remove the blank pages.

I made a method where I made a comparison between a blank image with the image scanned but I'm having problems with performance
MagickImage blankPagePattern = new MagickImage("blank.tiff");
MagickImageCollection newFile= new MagickImageCollection();
using (MagickImageCollection collection = new MagickImageCollection(scannedFile)){
    foreach (MagickImage img in collection) {
          double error = img.Compare(blankPagePattern, ErrorMetric.MeanErrorPerPixel);
          if (error > Convert.ToDouble(nsThreshold.Value)) {
                        newFile.Add(img.Clone());
          }
    }
}
newFile.Write(scannedFile);
There is a better way to do this?
Coordinator
Apr 14, 2016 at 7:56 PM
What do you consider a blank page? Can you add a link to blank.tiff on something like dropbox?