I need to convert a whole bunch of static SWFs to SVGs and I was hoping that there was some sort of command line tool I could use so I could script it with PowerShell. Does anyone know of such an application?
5 Answers
Sourceforge seems to have an SWF to SVG converter.
http://swf2svg.sourceforge.net/
Or, the other way around
-
This, unfortunately is a web-based application. As the title of the question states, I need to automate this from a command-line, with no dependencies on an internet connection.– bleshCommented Oct 20, 2010 at 17:14
-
Sorry, I followed the link to the source code and missed the "Web converter tool" midway down the page. The svg2swf tool is command line so I stupidly assumed the swf2svg was too.– mazianniCommented Oct 20, 2010 at 18:34
Research In Motion's development kit has a command line utility for this. You can get it in the dev kit here. The file is in the bin directory and is called swftosvg.exe.
Usage:
swftosvg [-help] [-version] [-o 'outputfile'] [-d 'imagedir'] 'inputfile'.swf
Options:
-help
display this help message
-version
display product version
-o
write the result of the conversion to 'outputfile' [default: 'inputfile'.svg]
-d
write converted images to directory 'imagedir' [default: same directory as 'outputfile']
SWF is not necessarily static, where SVG usually is, there's no real way of converting SWF to SVG.
-
-
1Also, I know it can be done, as I've done it in the past, but I can't remember the app I used because it was two years ago.– bleshCommented Oct 4, 2010 at 15:01
-
@blesh doesn't matter, they generally aren't... SWF and SVG are two very different kind of files...– PylsaCommented Oct 4, 2010 at 15:01
-
1I've done it in the past. So yes, it can be done. In fact, there's a [web tool to do it][1], but what I'm looking for is a command line tool to do it. [1]: eprg.org/~sgp/swf2svg.html– bleshCommented Oct 4, 2010 at 15:11
-
I've checked a few links and they all return 404 or are redirects. Since this is a very old question.
I've found a way to do this using Python library pyswf on GitHub. The readme shows how to write a simple CLI that will convert SWF to SVG.
Copy-pasting it for reference:
from swf.movie import SWF
from swf.export import SVGExporter
# create a file object
file = open('path/to/swf', 'rb')
# load and parse the SWF
swf = SWF(file)
# create the SVG exporter
svg_exporter = SVGExporter()
# export!
svg = swf.export(svg_exporter)
# save the SVG
open('path/to/svg', 'wb').write(svg.read())
Note that PIP version was not working, as I'm writing this, with Python 3, I was needed to install pip2.7 to use the library.
If you have a problem installing pip2.7 here is a question on StackOverflow: how to use python2.7 pip instead of default pip