This piece of code will help you to generate images from your flash movie files[.swf].
Sometime it's very important to get the screen shot of the first frame of .swf files. These things needs mostly whenever you work with ActiveX component like flash with ASP.Net. This program will extract the very first frame of the flash movie file and will save it as popular image formats like .jpg, .gif, .png, .bmp on the fly.
Using the code
Using the code is very simple but before that you have to setup some basic things. In this application I have used Interop.SWFToImage.dll to convert the swf files.
So at first download SWFToImage.exe from http://www.bytescout.com . This is a free product. Just download it and install the .exe file.
Your set up is ready to execute the application. Now add a reference of the Interop dll. The dll will be found within the installation directory, in the "Redistributable" folder.
Now import the SWFToImage class and create an object of it. Rest is easy. Here are some important code snippet.
swfobj.InputSWFFileName = FileUpload1.PostedFile.FileName
swfobj.ImageOutputType = TImageOutputType.iotJPG
swfobj.SaveToFile(Server.MapPath("dumps/images/" & filenm))
Here swfobject is the object of the SWFToImage class. The property ImageOutputType receives the format of the converted image[.jpg, .gif, .png, .bmp].
According to the folder structure the uploaded files will be stored in the "dumps/swf" and the converted images will be stored in the "dump/images" folder.