Base class for image grayscaling.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: (


public class Grayscale : BaseFilter


This class is the base class for image grayscaling. Other classes should inherit from this class and specify RGB coefficients used for color image conversion to grayscale.

The filter accepts 24, 32, 48 and 64 bpp color images and produces 8 (if source is 24 or 32 bpp image) or 16 (if source is 48 or 64 bpp image) bpp grayscale image.

Sample usage:

// create grayscale filter (BT709)
Grayscale filter = new Grayscale( 0.2125, 0.7154, 0.0721 );
// apply the filter
Bitmap grayImage = filter.Apply( image );

Initial image:

Result image:

Inheritance Hierarchy

See Also