Last active
November 26, 2018 23:53
-
-
Save Lucas7yoshi/91e642901a073f276a32286d4adb980b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make a variable of: List<Image> | |
// I'm not going to give any support other than saying that you need to run this in a form app in c# | |
// It assumes a image size of 256 x 256, change the values at will. | |
var numperrow = 4; | |
var w = 256 * numperrow; | |
int h = int.Parse(Math.Ceiling(double.Parse(imgs.Count.ToString()) / numperrow).ToString()) * 256; | |
if (imgs.Count * 256 < 256 * numperrow) | |
{ | |
w = imgs.Count * 256; | |
} | |
var num = 1; | |
var cur_w = 0; | |
var cur_h = 0; | |
Bitmap bmp = new Bitmap(w, h); | |
using (Graphics g = Graphics.FromImage(bmp)) | |
{ | |
foreach (var i in imgs) | |
{ | |
g.DrawImage(i, new PointF(cur_w, cur_h)); | |
if (num % numperrow == 0) | |
{ | |
cur_w = 0; | |
cur_h += 256; | |
num += 1; | |
} | |
else | |
{ | |
cur_w += 256; | |
num += 1; | |
} | |
} | |
} | |
bmp.Save(Directory.GetCurrentDirectory() + "output.png"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment