Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render Flash (SWF) frame as image (PDF,PNG,JPG)

I would like to write a python script that takes a bunch of swf files and renders them to individual image files.

Each swf file has just one frame (text, pictures etc.) and no animations at all. I have already tried the render command from the swftools toolset (The windows version), but the resolution of the resulting image is too low.

So what I need is:

A command line tool (Windows/Linux) or a python library which renders one frame from a swf to a bitmap or better to something like a PDF (It would be cool if the text data could be retained). It would be great if the target resolution/size could be set manually.

Thanks in advance!

like image 931
das_weezul Avatar asked Jun 07 '10 10:06

das_weezul


1 Answers

I'm sorry to answer my own question, but I found an undocumented feature of swfrender (part of the swftools) by browsing through the sources.

swfrender path/to/my.swf -X<width of output> -Y<height of output>
-o<filename of output png>

As you might have guessed the X option lets you determine the width (in pixels) of the output and Y does the same for the height. If you just set one parameter, then the other one is chosen in relation to the original height-width-ratio (pretty useful)

That does the trick for me but as Zarate offered a solution that might be even better (I'm thinking of swf to PDF conversion) he deserves the credits.

Cheers

like image 92
das_weezul Avatar answered Sep 28 '22 19:09

das_weezul