find almost completely white pictures

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
forte.giulio
Posts: 2
Joined: 2018-01-13T01:57:23-07:00
Authentication code: 1152

find almost completely white pictures

Post by forte.giulio »

Hi
I am writing small VB.NET application that delete almost white jpeg images in a folder.
The images are generated by a scanner.

For IM I found that the command line commando could be like this:
convert image1.jpg -format "%[fx:mean>0.99?1:0]"
As this is my first project with Magick.NET, I would be very grateful to anyone who can give me a hint on how to do that with Magick.NET in vb.net or C #

Thanks
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: find almost completely white pictures

Post by dlemstra »

You can use the `FormatExpression` method for this in Magick.NET:

Code: Select all

using (var image = new MagickImage("image1.jpg"))
{
    var mean = image.FormatExpression("%[fx:mean>0.99?1:0]");
    if (mean == "1")
    {
        // Do something...
    }
}
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
forte.giulio
Posts: 2
Joined: 2018-01-13T01:57:23-07:00
Authentication code: 1152

Re: find almost completely white pictures

Post by forte.giulio »

Thanks it works perfekt :D
Post Reply