Bytescout Image To Video SDK can apply various visual effects to slides when converting images to video slideshow.
The VB.NET and C# sample codes below demonstrate how to use slide effects or rotate slides when you convert JPG, PNG, BMP images to video slideshow in AVI or WMV format with Image To Video SDK.
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
' Add images and set slide durations and effects
Dim slide As Slide
slide = CType(converter.AddImageFromFileName("........slide1.jpg"), Slide)
slide.Duration = 3000 ' 3000ms = 3s
slide.VisualEffect = VisualEffectType.veGrayscale ' make the slide grayscale
slide = CType(converter.AddImageFromFileName("........slide2.jpg"), Slide)
slide.Duration = 3000
slide.VisualEffect = VisualEffectType.veSepia ' make the slide sepia
slide = CType(converter.AddImageFromFileName("........slide3.jpg"), Slide)
slide.Duration = 3000
slide.RotationAngle = RotationAngle.raRotate90 ' rotate the slide 90 degrees.
' Set output video size
converter.OutputWidth = 400
converter.OutputHeight = 300
' 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 SlideEffects
{
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";
// Add images and set slide durations and effects
Slide slide;
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide1.jpg");
slide.Duration = 3000; // 3000ms = 3s
slide.VisualEffect = VisualEffectType.veGrayscale; // make the slide grayscale
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide2.jpg");
slide.Duration = 3000;
slide.VisualEffect = VisualEffectType.veSepia; // make the slide sepia
slide = (Slide) converter.AddImageFromFileName("..\..\..\..\slide3.jpg");
slide.Duration = 3000;
slide.RotationAngle = RotationAngle.raRotate90; // rotate the slide 90 degrees.
// Set output video size
converter.OutputWidth = 400;
converter.OutputHeight = 300;
// 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");
}
}
}