How can I obtain human readable string(i.e. image format itself) from System.Drawing.ImageFormat object?
I mean if I have ImageF
ImageFormat values are identified by Guid you need to create your own map of Guid -> Name
var dict = (
from t in typeof(ImageFormat).GetProperties()
where t.PropertyType == typeof(ImageFormat)
let v = (ImageFormat)t.GetValue(null, new object[0])
select new { v.Guid, t.Name }
).ToDictionary(g => g.Guid, g => g.Name);
string name;
if (dict.TryGetValue(ImageFormat.Png.Guid, out name))
{
Console.WriteLine(name);
}