SWF To Image library - how to convert all SWF flash files in the folder into JPEG images - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

SWF To Image library – how to convert all SWF flash files in the folder into JPEG images

  • Home
  • /
  • Articles
  • /
  • SWF To Image library – how to convert all SWF flash files in the folder into JPEG images

This example will teach you how to convert all SWF (flash) files in a folder into JPEG images using SWF To Image library

A folder with SWF flash movies:

Folder with flash movies to convert

SWF To Image library is freeware. However you are welcome to purchase 12 months tech support for it and so support development of SWF To Image library.
 

The code below will find all flash (swf) files in a folder and then will convert them into JPEG images with the same name and .jpg extension

‘ This example converts all SWF files in the folder into JPG image files
‘ Copy this script to the folder with SWF flash movies and run it
‘ Script will generate JPG image files using extracted frames from SWF

Set SWFToImage = CreateObject(“SWFToImage.SWFToImageObject”)

SWFToImage.InitLibrary “demo”, “demo”

Dim WshShell, fs, f, fc, f1, tsFile
Set WshShell = WScript.CreateObject(“WScript.Shell”)

sCurrentFolder = WshShell.CurrentDirectory

Set fs = CreateObject(“Scripting.FileSystemObject”)
Set f = fs.GetFolder(sCurrentFolder) ‘ current directory
Set fc = f.Files
Set fs = Nothing

‘ converting SWF files to JPG image files
For Each f1 in fc
if UCase(Mid(f1.name, InstrRev(f1.name, “.”) + 1)) = “SWF” then
SWFToImage.InputSWFFileName = f1.name
SWFToImage.FrameIndex = 1 ‘ number of frame to extract
SWFToImage.ImageOutputType = 1 ‘ set output image type to Jpeg (0 = BMP, 1 = JPG, 2 = GIF)
SWFToImage.Execute
SWFToImage.SaveToFile Mid(f1.name, 1, Instr(f1.name, “.”) – 1) & “.jpg”
End If

Next

Set SWFToImage = nothing

The script code will convert every SWF file into JPG image in the same folder:

JPG  images in the folder

Tutorials:

prev
next