예제 #1
0
        private async Task extractImage()
        {
            this.progressLabel.Content = "Please wait extracting image ...";
            string stegImageFilename = this.stegImage.GetImageFilename();

            System.Drawing.Bitmap hiddenBitmap = null;
            await Task.Run(() =>
            {
                try
                {
                    hiddenBitmap = StenographyAlgorithm.ExtractHiddenImage(stegImageFilename);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            if (hiddenBitmap == null)
            {
                this.progressLabel.Content = "Error";
                return;
            }

            hiddenImage.Source         = Util.LoadBitmap(hiddenBitmap);
            this.progressLabel.Content = "Image extracted";
        }
        private async Task saveStegImage(string filename)
        {
            this.progressLabel.Content = "Please wait creating Image ...";
            var visibleImageFilename = this.visibleImage.GetImageFilename();
            var hiddenImageFilename  = this.hiddenImage.GetImageFilename();

            System.Drawing.Bitmap stegBitmap = null;
            await Task.Run(() =>
            {
                try
                {
                    stegBitmap = StenographyAlgorithm.EmbedImage(visibleImageFilename, hiddenImageFilename);
                    stegBitmap.Save(filename);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            if (stegBitmap == null)
            {
                this.progressLabel.Content = "Error";
                return;
            }

            this.progressLabel.Content = "Image saved";
        }