How to set background picture when converting images to video slideshow with Image To Video SDK - 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!

How to set background picture when converting images to video slideshow with Image To Video SDK

  • Home
  • /
  • Articles
  • /
  • How to set background picture when converting images to video slideshow with Image To Video SDK

When converting set of JPG, PNG, BMP images to AVI or WMV video slideshow with Image To Video SDK, you can use a picture as movie background.

The sample codes below show how to set picture as a video slideshow background during conversion in VB.NET and C#.

Visual Basic .NET

Imports BytescoutImageToVideoLib

Module Module1

Sub Main()

Console.WriteLine("Converting JPG slides into video, please wait..")

' Create BytescoutImageToVideoLib.ImageToVideo object instance
Dim converter As ImageToVideo = New ImageToVideo()

' Activate the component
converter.RegistrationName = "demo"
converter.RegistrationKey = "demo"

' 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

' Set movie background picture
converter.SetBackgroundPictureFileName("........background.jpg")

' Add images and set slide durations

Dim slide As Slide
slide = CType(converter.AddImageFromFileName("........slide1.jpg"), Slide)

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

slide.Duration = 3000
slide = CType(converter.AddImageFromFileName("........slide3.jpg"), Slide)

slide.Duration = 3000

' Set output video size
converter.OutputWidth = 500

converter.OutputHeight = 400

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

' Run the conversion
converter.RunAndWait()

Console.WriteLine("Conversion is done. Press any key to continue...")

Console.ReadKey

' Open the result video file in default media player
Process.Start("result.wmv")

End Sub

End Module 

Visual C#

using System;
using System.Diagnostics;

using BytescoutImageToVideoLib;

namespace BackgroundPicture
{
class Program
{

static void Main(string[] args)
{

Console.Write("Converting JPG slides into video, please wait..");

// Create BytescoutImageToVideoLib.ImageToVideo object instance
ImageToVideo converter = new ImageToVideo();

// Activate the component
converter.RegistrationName = "demo";
converter.RegistrationKey = "demo";

// Set movie background picture
converter.SetBackgroundPictureFileName("..\..\..\..\background.jpg");

// Add images and set slide durations

Slide slide;
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide1.jpg");

slide.Duration = 3000; // 3000ms = 3s
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide2.jpg");

slide.Duration = 3000;
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide3.jpg");

slide.Duration = 3000;

// Set output video size
converter.OutputWidth = 500;

converter.OutputHeight = 400;

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

// Run the conversion
converter.RunAndWait();

Console.WriteLine("Conversion is done. Press any key to continue..");

Console.ReadKey();

// Open the result video file in default media player
Process.Start("result.wmv");

}
}
} 

Download output video file: result.zip (extract and run result.wmv to see the conversion sample)

Tutorials:

prev
next