Converting images to video using Bytescout Image To Video SDK in VBScript (.VBS, Visual Basic Script) - ByteScout

Converting images to video using Bytescout Image To Video SDK in VBScript (.VBS, Visual Basic Script)

  • Home
  • /
  • Articles
  • /
  • Converting images to video using Bytescout Image To Video SDK in VBScript (.VBS, Visual Basic Script)

This sample source code shows how to convert set of images to video slideshow in AVI or WMV format using Image To Video SDK in VBScript (.VBS).

You can save this sample source code as Test.VBS file and double-click it to run in Explorer.

' Create an instance of BytescoutImageToVideo.ImageToVideo ActiveX object
Set converter = CreateObject("BytescoutImageToVideo.ImageToVideo")

' Activate the component

converter.RegistrationName = "demo"
converter.RegistrationKey = "demo"

MsgBox "The script will now convert 3 slides into Result.wmv video file"

' set default in effect for slides (you can also set effects for each single slide)
converter.Slides.DefaultSlideInEffect = 1 ' teFadeIn (1) - fades in effect for slides transition

converter.Slides.DefaultSlideInEffectDuration = 500 ' 500 msec for in effect

' Add images and set the duration for every slide
Set slide = converter.AddImageFromFileName("....slide1.jpg")

slide.Duration = 3000 ' 3000ms = 3s
Set slide = converter.AddImageFromFileName("....slide2.jpg")

slide.Duration = 3000
Set slide = converter.AddImageFromFileName("....slide3.jpg")

slide.Duration = 3000

' Set output video size
converter.OutputWidth = 400

converter.OutputHeight = 300

' Set output video file name
converter.OutputVideoFileName = "result.wmv"

' Run the conversion
converter.RunAndWait()

MsgBox "Result.wmv is ready. Script will try to open the video in default media player"

' Open result in default media player
Set shell = CreateObject("WScript.Shell")
shell.Run "result.wmv", 1, false

Set shell = Nothing

Set converter = Nothing 

Tutorials:

prev
next