swfrender from swftools works for basic SWF files.
swfdec-thumbnailer of swfdec-gnome works, although it only receives the first swf frame.
To get any frame from swf using swfdec, see the C code snippet in the following post mailing list.
gnash from gnash also works gnash -s<scale-image-factor> --screenshot last --screenshot-file output.png -1 -r1 input.swf , the last swf image.
ffmpeg from ffmpeg also works for some SWF formats ffmpeg -i movie.swf -f image2 -vcodec png movie%d.png
Also see the following guide for the command line pipeline.
To call external programs with php, you use the exec command registered here .
Note that for security reasons, it is important to avoid arguments passed to exec with another command, such as escapeshellcmd or escapeshellarg for security reasons.
After converting to an image format, whether for a single frame or the entire frame, you cannot run the script action. Other tools other than GNU / Linux support exporting script actions from SWF.
If the SWF that you export to PNG is too complicated for other tools than you can use the Flash plugin or gnash and Xvfb along with screen capture software for capturing SWF image frames or a video format such as avi. Then you can extract images from the video format.
This virtual framebuffer method will support complex SWF files, although it requires a lot of work, since you need to use Gnash and Xvfb and Screen Capture, or a browser, Xvfb and Selenium if you want to capture a specific set of mouse / keyboard interacts with SWF.
Gnash with and without Virtual TemplateBuffer should load ActionScript before exporting, but may have problems with complex ActionScript. The Flash plugin with Virtual Framebuffer will load ActionScript before exporting.
Also see the following StackOverFlow questions you ask, duplicate
- Convert SWF to PNG
- Render Flash Frame (SWF) as Image (PDF, PNG, JPG)
- SWF for image (jpg, png, ...) with PHP