GDI+ 多图像按指定行列实现图像合并

编程开发 gdi+图像拼图Graphics图像合并

使用 Graphics 将n张图像合并成一张宫格图

public class FilmFormat
    {
        public int cols { get; set; }//列数
        public int rows { get; set; }//行数
    }

///多图像按指定行列合并
private Bitmap SplicingMatrix(List<Bitmap> ImageBitmapQueue, FilmFormat Format)
        {
            int CellWidth = (int)(ImageBitmapQueue.Max(e => e.Width));
            int CellHeight = (int)(ImageBitmapQueue.Max(e => e.Height));
            Bitmap bitmap = new Bitmap(Format.cols * CellWidth, Format.rows * CellHeight);
            Graphics g = Graphics.FromImage(bitmap);
            g.SmoothingMode = SmoothingMode.HighSpeed;
            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
相关推荐
免责声明 本站部分内容来源于互联网公开资源分享学习交流,若其中有侵犯到了您的权益 还请邮件联系我方删除