public Bitmap(string file) { ReadStream stream = new ReadStream(File.ReadAllBytes(file)); string extension = Path.GetExtension(file); switch (extension.ToLower()) { case ".bmp": BMP.Decode(stream, this); break; case ".png": PNG.Decode(stream, this); break; default: Debug.Assert(false, "Image file extension not supported: {0}", extension); break; } }