![](https://www.myluoluo.com/wp-content/uploads/2017/05/1.jpg)
// 图片截取:
// C:\ffmpeg-20160921-7447ec9-win64-static\bin\ffmpeg.exe -i C:\Users\Master\Dropbox\视频\0001.新浪网-樱花-遇到你真好~~.flv -s 250x140 -vf fps=1/30 C:\Users\Master\Dropbox\程序源码\C#\WinForm\DrawImage\DrawImage\bin\Debug\Capture\img1%03d.jpg
var imgList = Directory.GetFiles(@"C:\Users\Master\Dropbox\程序源码\C#\WinForm\DrawImage\DrawImage\bin\Debug\Capture");
var oneImgWidth = 250;
var oneImgHeight = 140;
var headerHeight = 70;
var interval = 4;
var columnCount = 3;
var totalWidth = columnCount * oneImgWidth + (columnCount + 1) * interval;
var rowCount = (imgList.Count() + columnCount - 1) / columnCount;
var totalHeight = rowCount * oneImgHeight + (rowCount + 1) * interval + headerHeight;
var rowNo = 0;
var colNo = 0;
var bmp = new Bitmap(totalWidth, totalHeight);
var g = Graphics.FromImage(bmp);
g.FillRectangle(Brushes.White, new Rectangle() { X = 0, Y = 0, Height = totalHeight, Width = totalWidth });
g.DrawString("\n 文件名称: 0001.新浪网-樱花-遇到你真好~~.flv\n 文件大小: 10.6 MB 视频尺寸: 512*288 视频时长: 00:04:55", new Font("楷体",13,FontStyle.Bold), Brushes.Black, new PointF() { X = 0, Y = 0 });
foreach (var file in imgList)
{
int imgX = colNo * oneImgWidth + (colNo + 1) * interval;
int imgY = rowNo * oneImgHeight + (rowNo + 1) * interval + headerHeight;
g.DrawImage(Image.FromFile(file), imgX, imgY);
colNo++;
if ((colNo % columnCount) == 0)
{
rowNo++;
colNo = 0;
}
}
bmp.Save("1.bmp");
return;
原代码为 QT,改了几处变为 C# 版本 (:з」∠),原作者:
http://www.cnblogs.com/haibindev/archive/2011/06/29/2079300.html
草长莺飞又一年. 主题好像变了? 但是为何内容木有更新?
偶尔看看,主题换了几次了,文章一直没更新。忙于工作,没啥东西可以记录(你有一封一年后的邮件,请查收