This project has moved and is read-only. For the latest updates, please go here.

Adaptive threshold negative offset

Jun 6, 2015 at 8:03 AM
Graphics Magick's convert command can perform local adaptive thresholding via the -lat option with a negative offset percentage. I tried this using GraphicsMagick.NET and the resultant image was empty. Using a positive or zero offset worked. Any suggestions?

Here's my code:
        using (var bitmap = new Bitmap(inputFile))
        using (MagickImage image = new MagickImage(bitmap))
        using (var outputStream = File.OpenWrite(outputFile))
        {
            image.Negate();
            image.AdaptiveThreshold(15, 15, new Percentage(-15));
            image.Write(outputStream, MagickFormat.Png);
        }
Jun 7, 2015 at 11:39 AM
This seems to be a 'bug' in Magick++ of GraphicsMagick, it only allows positive offsets. I have contacted to maintainer of GraphicsMagick and asked him to change this in the next release of GraphicsMagick.
Jun 7, 2015 at 5:50 PM
Awesome, thank you!
Jun 7, 2015 at 9:42 PM
Jun 8, 2015 at 7:30 PM
Holy smokes, you guys are quick! Do you have an estimate as to when this could be included in the .NET wrapper, or should I just build the latest C++ library and make the modification in the .NET wrapper?
Jun 9, 2015 at 8:18 AM
I will try to publish a new release this weekend that includes this fix.
Jun 9, 2015 at 2:52 PM
OK, thanks again.