CSharp examples for System.Drawing.Imaging:ImageFormat
Image Format From Mime Type
using System.Net; using System.IO;/*from w w w. j av a2 s. c o m*/ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing; using System; public class Main{ public static ImageFormat ImageFormatFromMimeType(String mimeType) { switch (mimeType) { case MIME_JPEG: case MIME_PJPEG: return ImageFormat.Jpeg; case MIME_GIF: return ImageFormat.Gif; case MIME_BMP: return ImageFormat.Bmp; case MIME_TIFF: return ImageFormat.Tiff; case MIME_PNG: return ImageFormat.Png; default: throw new ArgumentException("Unsupported MIME type '" + mimeType + "'", "mimeType"); } } }