How to convert JPG to AVI video in Visual C# and VB .NET using Bytescout Image To Video SDK - ByteScout

How to convert JPG to AVI video in Visual C# and VB .NET using Bytescout Image To Video SDK

  • Home
  • /
  • Articles
  • /
  • How to convert JPG to AVI video in Visual C# and VB .NET using Bytescout Image To Video SDK

These samples show how to convert JPG, JPEG to AVI video.

Image To Video SDK provides set of methods and properties for converting image sequence to video slideshow with transitions, slide effects, background music and color.

Convert JPG to video in Visual C# or Visual Basic .NET using the source codes below.

VISUAL C#

using System;
using System.Diagnostics;
using BytescoutImageToVideoLib;

namespace SimpleSlideshow
{
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 the duration for every slide
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 = 400;

converter.OutputHeight = 300;

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

// 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.avi");

}
}
} 

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 the duration for every slide
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 = 400

converter.OutputHeight = 300

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

' 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.avi")

End Sub

End Module 

Tutorials:

prev
next