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 » 2018-01-13T02:15:16-07:00

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: 1483
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: find almost completely white pictures

Post by dlemstra » 2018-01-14T03:49:41-07:00

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 » 2018-01-15T10:21:42-07:00

Thanks it works perfekt :D

Post Reply