public Image Render() { List <Image> temp = new List <Image>(); //1 определить максимальную ширину int _width = 0; foreach (Image img in Images) { if (img.Width > _width) { _width = img.Width; } } //2 подогнать все картинки под одну ширину foreach (Image img in Images) { float k = _width / (float)img.Width; temp.Add(ImageProcess.ScaleImage(img, k)); } //3 собрать все картики в одну //суммарная высота int _height = 0; foreach (Image img in temp) { _height += img.Height; } Bitmap dest = new Bitmap(_width, _height); int y = 0; foreach (Image img in temp) { Graphics.FromImage(dest).DrawImage(img, 0, y); y += img.Height; } return(dest); }
public Image Render() { List <Image> temp = new List <Image>(); //1 определить максимальную высоту int height = 0; foreach (Image img in Images) { if (img.Height > height) { height = img.Height; } } //2 подогнать все картинки под одну высоту foreach (Image img in Images) { float k = height / (float)img.Height; temp.Add(ImageProcess.ScaleImage(img, k)); } //3 собрать все картики в одну //суммарная ширина int width = 0; foreach (Image img in temp) { width += img.Width; } Bitmap dest = new Bitmap(width, height); int x = 0; foreach (Image img in temp) { Graphics.FromImage(dest).DrawImage(img, x, 0); x += img.Width; } return(dest); }