ImageDecoder Class |
Namespace: Accord.Imaging.Formats
The ImageDecoder type exposes the following members.
Name | Description | |
---|---|---|
DecodeFromFile(String) |
Decode first frame for the specified file.
| |
DecodeFromFile(String, ImageInfo) |
Decode first frame for the specified file.
| |
RegisterDecoder | Obsolete.
Obsolete. Please mark your decoder class with the FormatDecoderAttribute instead.
|
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 |
---|
If the class can not find the appropriate decoder, it will delegate the file decoding to .NET's internal image decoders. |
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);