Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I'd like to pose a challenging question to you. How is it possible to identify a blank fax page that is mostly filled with white color using the ImageMagick tool. This is common problem that arises when someone sends a blank page facing the screen.
You can attempt to '-trim' the page with a '-fuzz' setting of say 10%
If the image size did not change (before IM v6.3.2) or you get the special 'Null' image (current release) then the page was blank. it could be any color, but basically uniform in that color.
I tried your suggestion, however, this won't work because the page isn't entirely white. Virtually all pages include fax headers and sometimes there are small pieces of black spots.
Do you think using the ratio of black to white pixel will do? And how is possible to get this information using MagickWand?
Thanks, Anthony. It works. I used -median instead of -blur. It seems it better this way, however, this method is a bit costly CPU-wise. It takes 4 seconds to process 2 pages. I may play some more with -blur to get it right.
Both -median and -blur are convolution operators that overlay a 'neighbourhood' array over each and every pixel in the image (watch out for virtual pixels). As such both are very costly in terms of processing power.
However you produced a ratio. Have a look at IM Examples 'comparing images' and the verbose identification of images. It may be that the faster way is to do a -shave, then the identify and if number black pixel is less than some threshold to treat it as blank.
It is all very relative and you need to decide what is the best solution.
WARNING: see if you can differentiate bettween a blank fax but containing only constant vertical lines, and a more normal one with horizontal lines of text.
These are fairly common, produces by fax machines with a bad scanner.
(Do you have a practical example?)
My idea to differentiate is to divide the image into seperate rows, then average all the row images, and fuzzy trim (not blurred trim) to see if there is any sharp vertical contant in the image. That constant can then be removed from all the rows of the previous image, before applying the original 'blank fax' determination method, you finally go with.