示例#1
0
        public static IMAGE SquishImage(this IMAGE srcImage, CompressionMode mode, CompressionOptions options, Action <string> logger)
        {
            var srcBitmap = srcImage.ToSquishImage();

            var blocks = srcBitmap.Compress(mode, options);

            var dstBitmap = Bitmap.Decompress(srcImage.Width, srcImage.Height, blocks, mode);

            logger("\t" + dstBitmap.CompareRGBToOriginal(srcBitmap).ToString());

            return(dstBitmap.ToImageSharp());
        }
        public static IMAGE SquishImage(this IMAGE srcImage, CompressionMode mode, CompressionOptions options, TestContext context)
        {
            var srcBitmap = srcImage.ToSquishImage();

            var blocks = srcBitmap.Compress(mode, options);

            var dstBitmap = Bitmap.Decompress(srcImage.Width, srcImage.Height, blocks, mode);

            context.WriteLine(dstBitmap.CompareRGBToOriginal(srcBitmap).ToString());

            return(dstBitmap.ToImageSharp());
        }