110,536
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using WindowsFormsApplication2;
using System.IO;
using AForge.Video.VFW;
namespace WindowsFormsApplication2
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
DirectoryInfo dir = new DirectoryInfo(@"D:\Image\");
DirectoryInfo[] listdir = dir.GetDirectories();
FileInfo[] listfile = dir.GetFiles();
AVIWriter avi = new AVIWriter("wmv3");
//AVIWriter avi = new AVIWriter();
qavi.Open(@"d:\"+System.DateTime.Now.ToString("yyyyMMMddhhmmss")+".avi", 358, 472);
foreach (FileInfo s in listfile)
{
//获得图像
Bitmap img = new Bitmap(@"D:\Image\" + s.Name);
//载入图像
avi.AddFrame(img);
}
////释放资源
avi.Close();
}
}
}