Code:
Private stringgetimageextension (MemoryStream ms) {Try{image Image=Image.fromstream (MS); if(Image. Rawformat.guid = = ImageFormat.Bmp.Guid)return ". bmp"; if(Image. Rawformat.guid = = ImageFormat.Emf.Guid)return ". Wmf"; if(Image. Rawformat.guid = = ImageFormat.Exif.Guid)return ". Exif"; if(Image. Rawformat.guid = = ImageFormat.Gif.Guid)return ". gif"; if(Image. Rawformat.guid = = ImageFormat.Icon.Guid)return ". Icon"; if(Image. Rawformat.guid = = ImageFormat.Jpeg.Guid)return ". jpg"; if(Image. Rawformat.guid = = ImageFormat.MemoryBmp.Guid)return ". bmp"; if(Image. Rawformat.guid = = ImageFormat.Png.Guid)return ". PNG"; if(Image. Rawformat.guid = = ImageFormat.Tiff.Guid)return ". TIFF"; if(Image. Rawformat.guid = = ImageFormat.Wmf.Guid)return ". Wmf"; return string. Empty; } Catch { return string. Empty; }}View Code
C # get Picture extensions