php 将 SWF 转换为 PNG

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2001946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 04:36:57  来源:igfitidea点击:

Convert SWF to PNG

phpflashimage

提问by Matchu

I'd like to be able to take a 1-frame SWF file and convert it to PNG through PHP. I'm okay with using command-line tools to get this done.

我希望能够获取 1 帧 SWF 文件并通过 PHP 将其转换为 PNG。我可以使用命令行工具来完成这项工作。

How could I go about doing this? I found an ActiveX library, but that seems like one too many layers. I also see that Gnash seems to have a PNG output class, but I can't figure out how to get to that from the command line without doing some deep coding of my own. Are there any other clever solutions available? Thanks!

我怎么能去做这件事?我找到了一个 ActiveX library,但这似乎层数太多。我还看到 Gnash 似乎有一个PNG 输出类,但我无法弄清楚如何从命令行获得它而不做一些我自己的深度编码。还有其他聪明的解决方案吗?谢谢!

EDIT:To clarify, this is not a one-time task I just want to be able to do once. I'd like to be able to have a PHP script perform this task on command. Thanks!

编辑:澄清一下,这不是我只想做一次的一次性任务。我希望能够让 PHP 脚本根据命令执行此任务。谢谢!

Another EDIT:One more clarification. This is not a situation in which, say, a user makes a drawing in Flash. I am downloading raw 1-frame SWF files, and want to save PNG copies in order to reduce download time. Is such a task possible? Thanks again!

另一个编辑:还有一个澄清。这不是用户在 Flash 中进行绘图的情况。我正在下载原始 1 帧 SWF 文件,并希望保存 PNG 副本以减少下载时间。这样的任务可能吗?再次感谢!

回答by bhups

you can use swftools.
swfrender file.swf -X pixelsize -Y pixelsize -o output.png

你可以使用swftools
swfrender file.swf -X pixelsize -Y pixelsize -o output.png

If only one between -X -Y parameter is specified then proportions are respected

如果仅指定了 -X -Y 参数之间的一个,则遵守比例

回答by karim

not really a server based solution, but i developed an AIR utility to convert SWF to PNG sequences: http://swfrenderer.kurst.co.uk/

并不是真正基于服务器的解决方案,但我开发了一个 AIR 实用程序来将 SWF 转换为 PNG 序列:http: //swfrenderer.kurst.co.uk/

回答by cOle2

Depending on the type of swf's you have you could try FFmpeg from the command line:

根据您拥有的 swf 类型,您可以从命令行尝试 FFmpeg:

ffmpeg -i movie.swf -f image2 -vcodec png movie%d.png