1

Does any body know how to get a thumbnail/snapshot of a specific frame of a smooth streaming file using C#.net and WPF.

Regards, Allan

Allan Chua
  • 9,305
  • 9
  • 41
  • 61

1 Answers1

2

Here MyPanel is the container where your video is streaming.

        var panelPoint = this.MyPanel.PointToScreen(new Point(this.MyPanel.ClientRectangle.X, this.MyPanel.ClientRectangle.Y));
        using (var bitmap = new Bitmap(320, 240))
        {
            using (var graphics = Graphics.FromImage(bitmap))
            {
                graphics.CopyFromScreen(320, Point.Empty, new Size(320, 240));
            }

            if (SimpleIoc.Default.ContainsCreated<ICommonApplicationData>())
            {
                var imageGuidName = Guid.NewGuid();
                fileName = Path.Combine("C:\", "TestFolder", imageGuidName + ".jpg");
                bitmap.Save(fileName, ImageFormat.Jpeg);
                var tempBitmapImage = new BitmapImage();
                tempBitmapImage.BeginInit();
                tempBitmapImage.UriSource = new Uri(fileName);
                tempBitmapImage.EndInit();
                image.Source = tempBitmapImage;
            }
        }
Palak.Maheria
  • 1,497
  • 2
  • 15
  • 32
  • This is not a good answer to the question. How can you get an image from a specific frame without going to that frame (without a screenshot). – Martín Apr 14 '15 at 20:56