Reputation: 11655
I have a Flash object in a SWF file. It contains an image that I need to extract, so I can use it directly for devices not supporting Flash.
How can I extract the image from the SWF? What tools should I use?
Upvotes: 22
Views: 69297
Reputation: 7139
An alternative to SWFTools (mentioned in the answers above) is JPEXS FFDec, a SWF decompiler and editor. Its main advantage is that you can preview images before extracting them. It is also slightly easier to use, being a GUI tool.
Once you have loaded a file in FFDec, click the "images" section in the side tree. To extract an image, right-click it and choose "Export selection", then "OK". You can select multiple items (in both the gallery view and the side tree) and extract them at the same time. To extract all images, right-click "images" in the side tree and use "Export selection" on that. The results will be in a newly-created "images" folder.
Upvotes: 2
Reputation:
I agree with using the open source toolkit as answered by Tom.
To build the tools and install on linux/mac, use these commands as specified in the wiki:
tar -zvxf swftools-0.x.x.tar
cd swftools-0.x.x
./configure
make
make install
Here is the command to extract all assets:
swfextract --outputformat "extract_%06d.%s" -a 1- test.swf
As specified in this wiki page.
Upvotes: 8
Reputation: 22841
There's an open source toolkit that works fairly well for the job. On Windows you'll need to run the installer as Administrator or it dies. Then add the folder to your PATH (or not) and you can pull jpegs out. First:
swfextract /path/to/file.swf
which will list all of the assets in the file. In this case, pay attention to the ids in the JPEG section. Then for each id, run
swfextract /path/to/file.swf -i id -o name-of-my-new-file.jpg
Upvotes: 29
Reputation: 4056
Well it depends on the situation, at any case you'll need a way to identify that image inside the file aka a symbol.
Case 1. Embed
[Embed(source="assets/library.swf", symbol="AImage")]
[Bindable]
public var AImage:Class;
Case 2. Runtime
(this code is executed once the loader has loaded your swf source file)
loader.contentLoaderInfo.applicationDomain.getDefinition("AImage");
Hope it helps
Upvotes: 2