Click here to Skip to main content
11,492,523 members (61,197 online)
Click here to Skip to main content

Convert SWF movie to Image [.jpg, .gif, .png, .bmp]

, 15 Jan 2008 CPOL 49.3K 2.8K 21
Rate this:
Please Sign up or sign in to vote.
Convert your swf movie file to image

Introduction

This piece of code will help you to generate images from your flash movie files[.swf].

Background

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.Execute()
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

arinhere
Web Developer
India India
No Biography provided

Comments and Discussions

 
Questionsource Pin
HosseinRabiee9-Aug-11 21:10
memberHosseinRabiee9-Aug-11 21:10 
GeneralI got the solution Pin
aaa200927-Oct-10 7:59
memberaaa200927-Oct-10 7:59 
GeneralBlack sreen is being captured as the image Pin
aaa200927-Oct-10 5:28
memberaaa200927-Oct-10 5:28 
QuestionMay you please give me any advice to convert big swf files like 200MB, 900MB and more to images? Pin
aaa200927-Oct-10 4:33
memberaaa200927-Oct-10 4:33 
GeneralAlignment problem Pin
shailendra118712-Feb-10 0:33
membershailendra118712-Feb-10 0:33 
GeneralRe: Alignment problem Pin
aaa200927-Oct-10 5:31
memberaaa200927-Oct-10 5:31 
QuestionWhite output image Pin
ronnyvdbempt3-Aug-09 6:42
memberronnyvdbempt3-Aug-09 6:42 
AnswerRe: White output image Pin
aaa200927-Oct-10 5:38
memberaaa200927-Oct-10 5:38 
I think, it is not the problem as you are not using the visual studio; but your swf video file might start after few seconds and at the very first moment, the video has only a white back ground and not the video. I have also the same problem and I have got the black image as my swf video starts after few seconds and at the very first moments it shows a black background. The problem is, this technique is getting the image from the very first of the swf video where the video has nothing to display except a white background(in your case) and a black background(in my case), so the image is being the same.

I have also queried for this issue and waiting for the kind respond from the author of this article
AnswerRe: White output image Pin
aaa200927-Oct-10 8:00
memberaaa200927-Oct-10 8:00 
GeneralRe: White output image Pin
mogi_102025-Dec-13 17:50
membermogi_102025-Dec-13 17:50 
General[Message Deleted] Pin
ronnyvdbempt2-Aug-09 23:28
memberronnyvdbempt2-Aug-09 23:28 
QuestionWhere to find SWFToImage.exe Pin
suresh Naidu.K11-Feb-09 23:08
membersuresh Naidu.K11-Feb-09 23:08 
AnswerRe: Where to find SWFToImage.exe Pin
arinhere11-Feb-09 23:11
memberarinhere11-Feb-09 23:11 
GeneralMy vote of 1 Pin
cagriarican21-Jan-09 6:25
membercagriarican21-Jan-09 6:25 
GeneralRe: My vote of 1 Pin
ytzipp4-Mar-09 17:29
memberytzipp4-Mar-09 17:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 15 Jan 2008
Article Copyright 2008 by arinhere
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid