In a library I am writing for some infrastructure projects at work, I have a method to create various scales of an image (for thumbnails etc…). However, the system that I am storing this data in is requiring a mime-type declared in the database for various reasons.
Is there a way to get a Mime type from the passed in c# Image class, or will I have to have external applications pass in the Mimetype along with the image?
You can get the
ImageFormatfrom theImage, and you can get the MIME type from theImageCodecInfo. All you need to do is tie the two together: