Free Trial
Web API version
Licensing
HAVE QUESTIONS OR NEED HELP? SUBMIT THE SUPPORT REQUEST FORM or write email to SUPPORT@BYTESCOUT.COM
Simple Slideshow (C#) for ByteScout Image To Video SDK
Default.aspx.cs:
C#
using System; using System.IO; using System.Web.UI; using BytescoutImageToVideo; namespace SimpleSlideshow { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { // These test files will be copied to the project directory on the pre-build event (see the project properties). String file1 = Server.MapPath("bin\\slide1.jpg"); String file2 = Server.MapPath("bin\\slide2.jpg"); String file3 = Server.MapPath("bin\\slide3.jpg"); String outputVideoFile = Path.GetTempPath() + "result.wmv"; // 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 = converter.AddImageFromFileName(file1); slide.Duration = 3000; // 3000ms = 3s slide = converter.AddImageFromFileName(file2); slide.Duration = 3000; slide = converter.AddImageFromFileName(file3); slide.Duration = 3000; // Set output video size converter.OutputWidth = 400; converter.OutputHeight = 300; // Set output video file name converter.OutputVideoFileName = outputVideoFile; // Run the conversion converter.RunAndWait(); // Release resources System.Runtime.InteropServices.Marshal.ReleaseComObject(converter); converter = null; // Show filename of result file Response.Clear(); Response.ContentType = "text/html"; if (File.Exists(outputVideoFile)) { Response.Write("Result video file: <b>" + outputVideoFile + "</b>"); } else { Response.Write("Conversion failed. Error information: " + converter.LastError); } Response.End(); } } }
Web.config:
<?xml version="1.0"?> <configuration> <appSettings/> <connectionStrings/> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true" /> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration>