User-1825738080 posted
I'm trying to determine which extension I should use when saving an image to disk from the Bitmap object.
private string GetExtension(Bitmap image)
{
if (image.RawFormat == ImageFormat.Bmp)
return ".bmp";
if (image.RawFormat == ImageFormat.Gif)
return ".gif";
if (image.RawFormat == ImageFormat.Png)
return ".png";
if (image.RawFormat == ImageFormat.Jpeg)
return ".jpg";
throw new FlexiException("Unsupported file format {0}", image.RawFormat.ToString());
}
In the debugger, it says the ImageFormat is Guid value
How do I determine the Bitmap's format to save the file correctly?