示例#1
0
            public void AsHuffmanEncodedAndDecodedWithSave(int imageIndex)
            {
                var i         = imageIndex;
                var cropSetup = new CropSetup {
                    LeftPx = 27 * 16, RightPx = 29 * 16, TopPx = 1 * 16, BottomPx = 6 * 16
                };
                var sourceFile      = Common.GetSourceImagePath(i);
                var image           = ImageFrame.FromFile(sourceFile).AsCroppedImage(cropSetup).AsGrayScale();
                var encodedFilename = Common.GetSaveImagePath(i, "gray-huffman-encoded");

                image.AsHuffmanEncoded().Save(encodedFilename);
                var encoded         = new HuffmanImageFrame().Open(encodedFilename);
                var decodedFilename = Common.GetSaveImagePath(i, "gray-huffman-decoded.bmp");

                encoded.AsImageGrayScaleFrame().Save(decodedFilename);
                var decoded = ImageFrame.FromFile(decodedFilename);

                Assert.True(image.Image.Compare(decoded.Image));
            }
 public ImageFrameGrayScale DecodeHuffman() => HuffmanEncoded.AsImageGrayScaleFrame();