我正在寻找执行以下操作的示例.NET代码(System.Drawing.Image):
加载给定的图像文件.生成一个新的单个图像,水平重复原始图像x次.
这将创建一个新的位图并将源位图绘制到它的numTimes时间.
Bitmap b = Bitmap.FromFile(sourceFilename);
Bitmap output = new Bitmap(b.Width * numTimes, b.Height);
Graphics g = Graphics.FromImage(output);
for (int i = 0; i < numTimes; i++) {
g.DrawImage(b, i * b.Width, 0);
}
// do whatever with the image, here we'll output it
output.Save(outputFilename);
// make sure to clean up too
g.Dispose();
b.Dispose();
output.Dispose();
Run Code Online (Sandbox Code Playgroud)