How to know image type/format by using Image class
I'm working with an image using System.Drawing.Image and I would like to know if I can get the type of it (ex: gif, jpeg...)
Image my开发者_JS百科Image;
format = myImage.SomethingThatTellsTheImageFormat;
or at least, is there some way to say if it's .gif or not
tks
Although I'm not a C#
user, the API seems to suggest that the RawFormat property is the way to go. The RawFormat property is an ImageFormat, which you can then compare to the (public) static properties of ImageFormat.
Just as little extension to Stephen's answer: The RawFormat can easily be compared with the public static properties of System.Drawing.Imaging.ImageFormat.
精彩评论