Format translations dictionary.

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


Dictionary<PixelFormat, PixelFormat> FormatTranslations { get; }


The dictionary defines, which pixel formats are supported for source images and which pixel format will be used for resulting image.

Keys of this dictionary defines all pixel formats which are supported for source images, but corresponding values define what will be resulting pixel format. For example, if value Format16bppGrayScale is put into the dictionary with the Format48bppRgb key, then it means that the filter accepts color 48 bpp image and produces 16 bpp grayscale image as a result of image processing.

The information provided by this property is mostly actual for filters, which can not be applied directly to the source image, but provide new image a result. Since usually all filters implement IFilter interface, the information provided by this property (if filter also implements IFilterInformation interface) may be useful to user to resolve filter's capabilities.

Sample usage:

// get filter's IFilterInformation interface
IFilterInformation info = (IFilterInformation) filter;
// check if the filter supports our image's format
if ( info.FormatTranslations.ContainsKey( image.PixelFormat )
    // format is supported, check what will be result of image processing
    PixelFormat resultingFormat = info.FormatTranslations[image.PixelFormat];

See Also