Working with different image formats

ImageTools is seperated in different assemblies. Each supported image format has its custom assembly to reduce the size of your application. By default the Image class does not know a image format and always throws an exception and you must register decoders and encoders first before loading files:

At the moment the following file formats are supported in the specified assemblies:
  • ImageTools.IO.Bmp
  • ImageTools.IO.Png
  • ImageTools.IO.Jpeg
  • ImageTools.IO.Gif (Only loading at the moment, saving gif images is not supported)

To register a decoder for loading images use the following line of code in your startup code:
ImageTools.IO.Decoders.AddDecoder<XXXDecoder>();


For example:
ImageTools.IO.Decoders.AddDecoder<BmpDecoder>();
ImageTools.IO.Decoders.AddDecoder<PngDecoder>();
ImageTools.IO.Decoders.AddDecoder<JpegDecoder>();
ImageTools.IO.Decoders.AddDecoder<GifDecoder>();


To register a encoder for saving/writing images use the following line of code in your startup code:
ImageTools.IO.Encoders.AddEncoder<XXXEncoder>();


For example:
ImageTools.IO.Encoders.AddEncoder<BmpEncoder>();
ImageTools.IO.Encoders.AddEncoder<PngEncoder>();
ImageTools.IO.Encoders.AddEncoder<JpegEncoder>();

Last edited Oct 20, 2010 at 5:31 PM by malignate88, version 2

Comments

rljc009 Sep 7, 2012 at 4:10 AM 
Just what I'm looking for.....