public static System.Drawing.Imaging.ImageFormat getImageFormat(string contentType)
{
var lowerContentType = contentType.ToLower();
if (lowerContentType.EndsWith("png"))
return System.Drawing.Imaging.ImageFormat.Png;
if (lowerContentType.EndsWith("bmp"))
return System.Drawing.Imaging.ImageFormat.Bmp;
if (lowerContentType.EndsWith("jpeg"))
return System.Drawing.Imaging.ImageFormat.Jpeg;
if (lowerContentType.EndsWith("jpg"))
return System.Drawing.Imaging.ImageFormat.Jpeg;
// gif -> png! resizing gif with gif imageformat ruins alpha values, therefore we return with png
if (lowerContentType.EndsWith("gif"))
return System.Drawing.Imaging.ImageFormat.Png;
if (lowerContentType.EndsWith("tiff"))
return System.Drawing.Imaging.ImageFormat.Tiff;
if (lowerContentType.EndsWith("wmf"))
return System.Drawing.Imaging.ImageFormat.Wmf;
if (lowerContentType.EndsWith("emf"))
return System.Drawing.Imaging.ImageFormat.Emf;
if (lowerContentType.EndsWith("exif"))
return System.Drawing.Imaging.ImageFormat.Exif;
return System.Drawing.Imaging.ImageFormat.Jpeg;
}
public static new Image CreateByBinary(IFolder parent, BinaryData binaryData)