public ImageFormat(BitmapCodecInformation info) { CodecInfo = info; DisplayName = ImageConverterCore.GetPrefferedDisplayName(info); DefaultFileExtension = ImageConverterCore.GetPrefferedFileExtension(info); Format = ImageConverterCore.GetFormat(info); }
public static Format GetFormat(BitmapCodecInformation info) { if (info.CodecId == BitmapEncoder.JpegEncoderId || info.CodecId == BitmapDecoder.JpegDecoderId) { return(Format.Jpeg); } if (info.CodecId == BitmapEncoder.JpegXREncoderId || info.CodecId == BitmapDecoder.JpegXRDecoderId) { return(Format.JpegXR); } if (info.CodecId == BitmapEncoder.GifEncoderId || info.CodecId == BitmapDecoder.GifDecoderId) { return(Format.Gif); } if (info.CodecId == BitmapEncoder.PngEncoderId || info.CodecId == BitmapDecoder.PngDecoderId) { return(Format.Png); } if (info.CodecId == BitmapEncoder.BmpEncoderId || info.CodecId == BitmapDecoder.BmpDecoderId) { return(Format.Bmp); } if (info.CodecId == BitmapEncoder.TiffEncoderId || info.CodecId == BitmapDecoder.TiffDecoderId) { return(Format.Tiff); } if (info.CodecId == BitmapEncoder.HeifEncoderId || info.CodecId == BitmapDecoder.HeifDecoderId) { return(Format.Heif); } if (info.CodecId == BitmapDecoder.WebpDecoderId) { return(Format.WebP); } if (info.CodecId == CodecSupport.RAWImageExtensionsDecoderID) { return(Format.RAW); } if (info.CodecId == CodecSupport.DDSDecoderID || info.CodecId == CodecSupport.DDSEncoderID) { return(Format.Dds); } return(Format.Unknown); }
public static string GetPrefferedDisplayName(BitmapCodecInformation info) { if (info.CodecId == BitmapEncoder.JpegXREncoderId) { return("JPEG-XR"); } if (info.CodecId == BitmapEncoder.HeifEncoderId) { return("HEIF"); } return(info.FriendlyName.Split(' ').FirstOrDefault()); }
public static Format GetFormat(BitmapCodecInformation info) { if (info.CodecId == BitmapEncoder.JpegEncoderId) { return(Format.Jpeg); } if (info.CodecId == BitmapEncoder.JpegXREncoderId) { return(Format.JpegXR); } if (info.CodecId == BitmapEncoder.GifEncoderId) { return(Format.Gif); } if (info.CodecId == BitmapEncoder.PngEncoderId) { return(Format.Png); } if (info.CodecId == BitmapEncoder.BmpEncoderId) { return(Format.Bmp); } if (info.CodecId == BitmapEncoder.TiffEncoderId) { return(Format.Tiff); } if (SupportsSDK17763) { if (info.CodecId == BitmapEncoder.HeifEncoderId) { return(Format.Heif); } } if (info.FriendlyName.StartsWith("DDS")) { return(Format.Dds); } return(Format.Unknown); }
public static string GetPrefferedFileExtension(BitmapCodecInformation info) { if (info.CodecId == BitmapEncoder.JpegEncoderId) { return(".jpg"); } if (info.CodecId == BitmapEncoder.JpegXREncoderId) { return(".wdp"); } if (info.CodecId == BitmapEncoder.HeifEncoderId) { return(".heic"); } return(info.FileExtensions.FirstOrDefault()); }