Click or drag to resize
Accord.NET (logo)

ImageDecoder Class

Image decoder to decode different custom image file formats.
Inheritance Hierarchy
SystemObject
  Accord.Imaging.FormatsImageDecoder

Namespace:  Accord.Imaging.Formats
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
public static class ImageDecoder
Request Example View Source

The ImageDecoder type exposes the following members.

Methods
  NameDescription
Public methodStatic memberDecodeFromFile(String)
Decode first frame for the specified file.
Public methodStatic memberDecodeFromFile(String, ImageInfo)
Decode first frame for the specified file.
Public methodStatic memberRegisterDecoder Obsolete.
Obsolete. Please mark your decoder class with the FormatDecoderAttribute instead.
Top
Remarks

The class represent a help class, which simplifies decoding of image files finding appropriate image decoder automatically (using list of registered image decoders). Instead of using required image decoder directly, users may use this class, which will find required decoder by file's extension.

By default the class will query all referenced assemblies for types that are marked with the FormatDecoderAttribute. If the user would like to implement a new decoder, all that is necessary is to mark a new class with the FormatDecoderAttribute and make it implement the IImageDecoder interface.

Note Note
If the class can not find the appropriate decoder, it will delegate the file decoding to .NET's internal image decoders.

Examples
string filename = Path.Combine(basePath, "lena.pgm");

// One way to decode the image explicitly is to use
Bitmap image1 = ImageDecoder.DecodeFromFile(filename);

// However, you could also obtain the same effect using
Bitmap image2 = Accord.Imaging.Image.FromFile(filename);
See Also