How can I obtain human readable string(i.e. image format itself) from System.Drawing.ImageFormat object?
I mean if I have ImageFormat.Png is that possible to convert it to “png” string?
EDIT: I see some misunderstanding here. Here is mine code:
Image objImage = Image.FromStream(file);
ImageFormat imFormat = objImage.RawFormat;
imFormat.ToString();
It returns “[ImageFormat: b96b3caf-0728-11d3-9d7b-0000f81ef32e]” but I want “Png“!
ImageFormat.Png.ToString()returns “Png”…EDIT: OK, it seems
ToStringreturns the name only forImageFormatinstances returned by the static properties…You could create a lookup dictionary to get the name from the Guid: