Exemplo n.º 1
0
            public void WriteToFile(string name)
            {
                var imagePath = CreateDirectoryForAssociatedImage(name);

                try
                {
                    using (var associatedBmp = ost.slide.ReadAssociatedImage(name))
                    {
                        var qualityParameter = ost.GetQualityEncoderParameter();

                        ImageCodecInfo formatEncoder;
                        switch (ost.format)
                        {
                        case "png":
                            formatEncoder = GetEncoder(ImageFormat.Png);
                            break;

                        case "jpeg":
                            formatEncoder = GetEncoder(ImageFormat.Jpeg);
                            break;

                        default:
                            formatEncoder = GetEncoder(ImageFormat.Bmp);
                            break;
                        }
                        associatedBmp.Save(imagePath, formatEncoder, qualityParameter);
                    }
                }
                catch (Exception)
                {
                    ;
                }
            }
Exemplo n.º 2
0
            private void SaveTile(string levelPath, int level, int col, int row)
            {
                var tilePath = CreateDirectoryForTile(levelPath, row, col);

                using (var tileBmp = GetTile(level, row, col))
                {
                    var qualityParameter = ost.GetQualityEncoderParameter();

                    var formatEncoder = GetEncoder(ost.format == "png" ? ImageFormat.Png : ImageFormat.Jpeg);

                    tileBmp.Save(tilePath, formatEncoder, qualityParameter);
                }
            }