public static void SaveFile(PNM bitmap, string path, PNMFormat format) { using (FileStream stream = File.Open(path, FileMode.Create, FileAccess.Write)) { switch (format) { case PNMFormat.PBM: RawPBM.SaveFile(bitmap, stream); break; case PNMFormat.PGM: RawPGM.SaveFile(bitmap, stream); break; case PNMFormat.PPM: RawPPM.SaveFile(bitmap, stream); break; default: throw new ArgumentException("format"); } } }
internal void SaveImage(string path, PNMFormat format) { PNM.SaveFile(Image, path, format); Path = path; Format = format; }