Reputation: 21
I have around 2,000 SWF files used for avatar generation for my website. Times have changed and I'd like to move away from Flash. My only issue with that is I would have to generate 2,000 PNG images from those SWF files to be able to do so. So, naturally, I looked into automated tools to help with that.
I was looking into swftools and found swfrender and it was a great tool but it didn't work for my SWF files. The object in the SWF files is positioned at 0, 0 and it's off the screen like so:
So, when swfrender renders the image, it turns out like this:
I'm looking for a tool that can extract the stage contents, no matter the position, and output it into a PNG image.
Some additional details:
I'd like this to be command-line if possible, so it can be done automatically and somewhat faster than it would take me to go through each one and manually export it.
Upvotes: 0
Views: 5176
Reputation: 577
Not to bring up zombie thread but after trying the swf tools as suggested by Lutarisco and not being able to install I found https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/version11.2.0
Hopefully this will help anyone else trying to extract images from their swfs :) You can set background colour to clear and choose export as shapes or frames, you can aslo manipulate the export size to get larger images
Upvotes: 2
Reputation: 301
What swfrender does is to render the SWF. You could try extracting the objects instead with swfextract, which is also included with swftools.
From the swftools Wiki:
To extract everything use...
swfextract --outputformat "extract_%06d.%s" -a 1- test.swf
And some help about it from the man page:
Extract all:
-a Extract all files
--outputformat "extract_%06d.%s" Filename to use for extraction (printf format)
Otherwise, if you'd prefer to only extract certain objects, you can do it:
To extract individual items. First, run
swfextract file.swf
and get whatever the flash application contains. The output looks like:
Objects in file file.swf:
[-i] 8 Shapes: ID(s) 2, 5, 7, 9, 11, 13, 15, 17
[-i] 1 MovieClip: ID(s) 18
[-j] 8 JPEGs: ID(s) 1, 4, 6, 8, 10, 12, 14, 16
[-F] 1 Font: ID(s) 3
[-f] 1 Frame: ID(s) 0
These are the objects you will be able to extract. For example, if you want to extract the third jpg (ID = 6) to a file file.jpeg, the command is:
swfextract -j 6 file.swf -o file.jpeg
So, if you wanted to extract everything from every SWF file, and not to mix all up, the best solution that comes to my mind is to have every bunch of files extracted from every SWF inside their own folder. You could reach that by using a for
loop: to create a folder for every SWF file, and to extract every element of the SWF inside that folder. That would be useful for processing them later.
But shapes, for example, are extracted as SWF, and you could render them, or resize them before rendering them.
Another point is that you'd maybe have to resize, or move the objects before rendering them. You can afford that with another tool inside swftools: swfcombine. This tool is usually used to combine SWF objects, but you can use it to move or resize the elements on it:
−d, −−dummy Don't require slave objects (for changing movie attributes)
And then you should be able to render it properly.
I'm sorry if I confused you, but there are so many options... It seems that it depends on the particular case (I don't know how this handles the different kinds of SWF, such as AS1, AS2, et cetera). In any case, I hope this helped you at least!
Upvotes: 4
Reputation: 123
Export > Export Image. Export it to png from a FLASH file. It's impossible to have the photo from SWF, unless you are using the Windows cutting tool.
Upvotes: -1