Render swf to png or other image format

How can I render swf for an image file in linux? I need to be able to load other swfs into this swf and run the actioncript code.

Is this possible on linux? I need to do this with PHP, which is good if I need to use command line tools.

+8
linux flash image converter png
source share
3 answers

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
+16
source share

This is the solution that I used as a result.

You can use a tool like Xvfb (X11 server) and run a standalone flash player projector in it (you may need to install a bunch of 32-bit libraries), then use a screen capture utility like import to capture the screen and crop it to size .

I found this page about rendering swf screenshots in linux. It also says that you can use gnash for this, however gnash will not work for a 9+ flash player.

+1
source share

Try this app for air http://swfrenderer.kurst.co.uk

It displays swf frame by frame

+1
source share

All Articles