Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Detecting empty pages in scanned Tiff

$
0
0
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?

Viewing all articles
Browse latest Browse all 3693

Trending Articles