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