0

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 myImage; format = myImage.SomethingThatTellsTheImageFormat; 

or at least, is there some way to say if it's .gif or not

tks

0

2 Answers 2

6

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.

Sign up to request clarification or add additional context in comments.

1 Comment

yes, it's by using the RawFormat property, comparing guid ids ex: myImage.RawFormat.Guid == ImageFormat.Gif.Guid =)
2

Just as little extension to Stephen's answer: The RawFormat can easily be compared with the public static properties of System.Drawing.Imaging.ImageFormat.

1 Comment

Thanks Florian, I have edited my answer to include your expansion (just to have them both in one answer). Please enjoy this upwards orange arrow.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.