public RawImageData Decode(byte[] data) { if (data == null || data.Length == 0) { throw new ArgumentNullException("data"); } return(WsqCodec.Decode(data)); }
public byte[] EncodeGdi(SD.Bitmap image, float bitrate = WsqCodec.Constants.DefaultBitrate, bool autoConvertToGrayscale = true) { if (image == null) { throw new ArgumentNullException("image"); } RawImageData data = null; if (autoConvertToGrayscale) { using (var source = Conversions.To8bppBitmap(image)) data = Conversions.GdiImageToImageInfo(source); } else { data = Conversions.GdiImageToImageInfo(image); } return(WsqCodec.Encode(data, bitrate, Comment)); }
public byte[] EncodeWpf(SWMI.BitmapSource image, float bitrate = WsqCodec.Constants.DefaultBitrate, bool autoConvertToGrayscale = true) { if (image == null) { throw new ArgumentNullException("image"); } SWMI.BitmapSource source = null; if (autoConvertToGrayscale) { source = Conversions.ToGray8BitmapSource(image); } else { source = image; } var data = Conversions.WpfImageToImageInfo(source); return(WsqCodec.Encode(data, bitrate, Comment)); }
/// <summary> /// Initializes the <see cref="Constants"/> class. /// </summary> static Constants() { DefaultCompressionRatio = WsqCodec.BitrateToCompressionRatio(DefaultBitrate); DefaultQuality = WsqCodec.CompressionRatioToQuality(DefaultCompressionRatio); }
public byte[] EncodeCompressionRatioWpf(SWMI.BitmapSource image, float compressionRatio, bool autoConvertToGrayscale = true) { return(EncodeWpf(image, WsqCodec.CompressionRatioToBitrate(compressionRatio), autoConvertToGrayscale)); }
public byte[] EncodeQualityWpf(SWMI.BitmapSource image, int quality, bool autoConvertToGrayscale = true) { return(EncodeCompressionRatioWpf(image, WsqCodec.QualityToCompressionRatio(quality), autoConvertToGrayscale)); }
public byte[] EncodeCompressionRatioGdi(SD.Bitmap image, float compressionRatio, bool autoConvertToGrayscale = true) { return(EncodeGdi(image, WsqCodec.CompressionRatioToBitrate(compressionRatio), autoConvertToGrayscale)); }
public byte[] EncodeQualityGdi(SD.Bitmap image, int quality, bool autoConvertToGrayscale = true) { return(EncodeCompressionRatioGdi(image, WsqCodec.QualityToCompressionRatio(quality), autoConvertToGrayscale)); }
public byte[] Encode(RawImageData image, float bitrate = WsqCodec.Constants.DefaultBitrate) { return(WsqCodec.Encode(image, bitrate, Comment)); }
public byte[] EncodeCompressionRatio(RawImageData image, float compressionRatio) { return(Encode(image, WsqCodec.CompressionRatioToBitrate(compressionRatio))); }
public byte[] EncodeQuality(RawImageData image, int quality) { return(EncodeCompressionRatio(image, WsqCodec.QualityToCompressionRatio(quality))); }