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

4

1 回答 1

2

这里的 MyPanel 是您的视频流式传输的容器。

        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;
            }
        }
于 2013-05-30T09:34:25.853 回答