public override MemBitmap LoadImage(string filename) { OutputImageFormat format; //TODO: review img loading, we should not use only its extension string fileExt = System.IO.Path.GetExtension(filename).ToLower(); switch (fileExt) { case ".pngx": case ".png": { using (FileStream fs = new FileStream(filename, FileMode.Open)) { return(PngIOStorage.Read(fs)); } } case ".jpg": { format = OutputImageFormat.Jpeg; } break; default: throw new System.NotSupportedException(); } //TODO: don't directly access file here //we should access file from host request using (FileStream fs = new FileStream(filename, FileMode.Open)) { return(LoadImage(fs, format)); } }
public override void SaveImage(MemBitmap bitmap, Stream output, OutputImageFormat outputFormat, object saveParameters) { switch (outputFormat) { case OutputImageFormat.Png: PngIOStorage.Save(bitmap, output); break; default: throw new NotSupportedException(); } //throw new NotImplementedException(); }