Search code examples
c#imageimage-processingimagemagickgraphicsmagick

Changing contrast and brightness with Magick.NET or GraphicsMagick.NET. Is it possible?


How can I change contrast and brightness using GraphicsMagick.NET?

The apparent method for contrast only receives a boolean, so I don't know how I can apply a range of contrast variations. For changing the brightness there isn't any method that seems to do that. Or do I need to apply several "filters" to be able to change any of these characteristics?


Solution

  • Both libraries have support for the BrightnessContrast method that uses a percentage to specify the range:

    using (MagickImage image = new MagickImage("logo:"))
    {
      image.BrightnessContrast(10, 10);
      image.Write(@"C:\test.png");
    }