简体   繁体   English

是否有一种简单的方法来自动截取屏幕截图?

[英]Is there an easy way to automate the taking of screenshots?

In what language can I write a quick program to take screenshots and also possibly emulate a keypress? 我可以用什么语言编写快速程序来截取屏幕截图,还可以模拟按键?

I have an animated/interactive flash movie that is a presentation. 我有一个动画/互动Flash电影,这是一个演示文稿。 I want to take a screenshot after I press a particular key. 按下特定键后,我想截取屏幕截图。

The end effect is a bunch of screenshots that I can print...basically captures the key moments in the flash presentation. 最终效果是我可以打印的一系列截图...基本上捕捉了Flash演示中的关键时刻。

I've written this in C# without much hassle. 我在C#中写这篇文章没有太多麻烦。 Here's the bulk of the code: 以下是大部分代码:

    using (Bitmap bitmap = new Bitmap(bitmapSize.Width, bitmapSize.Height, PixelFormat.Format24bppRgb))
    using (Graphics graphics = Graphics.FromImage(bitmap))
    {
        graphics.CopyFromScreen(
            new Point(0, 0), 
            new Point(0, 0), 
            bitmapSize);
        bitmap.Save(filename, ImageFormat.Png);
    }

I would recommend writing an app that hosts a browser control. 我建议编写一个托管浏览器控件的应用程序。 Then you could have the browser control show the SWF and your app would know the exact coordinates of the part of the screen you need to capture. 然后,您可以让浏览器控件显示SWF,您的应用程序将知道您需要捕获的屏幕部分的确切坐标。 That way you can avoid having to capture a whole screen or whole window that you may have to crop later. 这样您就可以避免捕获整个屏幕或整个窗口,以后可能需要进行裁剪。

i am sure there are ways, but here's my idea. 我确信有办法,但这是我的想法。 you can convert your movie frames to pictures using tools like ffmpeg . 您可以使用ffmpeg等工具将电影帧转换为图片。 From the man page of ffmpeg 来自ffmpeg的手册页

ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg

This will extract one video frame per second from the video and will output them in files named foo-001.jpeg, foo-002.jpeg, etc. Images will be rescaled to fit the new WxH values. 这将从视频中每秒提取一个视频帧,并将其输出到名为foo-001.jpeg,foo-002.jpeg等的文件中。图像将被重新调整以适应新的WxH值。

If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time. 如果只想提取有限数量的帧,可以将上述命令与-vframes或-t选项结合使用,或与-ss结合使用以开始从某个时间点提取。

The number in the file name "simulates" the key press, so if you extracted for 1 sec per frame, and you want to "press" the key at 30sec, use the file name with foo-030.jpeg 文件名中的数字“模拟”按键,因此如果您每帧提取1秒,并且想要在30秒“按”键,请使用foo-030.jpeg的文件名

There's a free tool that I found about recently that does the screen capture part, It's apparently written in java. 我最近发现了一个免费的工具,它可以用于屏幕捕获部分,它显然是用java编写的。

http://screenr.com/ http://screenr.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自动截取程序窗口的截图 - Automatically taking screenshots of program window 截屏软件在未连接时不截屏 (RDP) - Screenshot software not taking screenshots while not connected (RDP) RDP断开连接时,Watin拍摄黑色屏幕截图 - Watin taking black Screenshots when RDP is disconnected 在 Windows 中自动执行任务的最佳方式 - Best way to automate tasks in windows 有没有一种简单的方法来制作 windows 服务? - is there an easy way to make a windows service? 在 Windows 中使用 C++ 截取窗口屏幕截图的最佳方法是什么? - What is the best way to take screenshots of a Window with C++ in Windows? 有没有一种方法可以自动在每个星期一发送一次Google表单? - Is there a way to automate sending a Google form every Monday? 自动枚举并将子文件夹插入命令行的方法 - Way to automate enumerating and inserting subfolders into a command line 有没有一种简单的方法可以检查系统上是否启用了CredSSP? - Is there an easy way to check if CredSSP is enabled on a systems? 有没有一种方法可以自动更改文件名 <link> , <script> tags - is there a way to automate changing filenames in <link> , <script> tags
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM