Created
July 16, 2022 11:41
-
-
Save bradmartin333/da73bdd3f7c5acb2192222a68c63b757 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
using System; | |
using System.Drawing; | |
namespace ImageGenerator | |
{ | |
internal class Program | |
{ | |
static Random RND = new Random(); | |
static void Main(string[] args) | |
{ | |
MakeSimpleGrid(); | |
} | |
static void MakeSimpleGrid() | |
{ | |
for (int k = 0; k < 10; k++) | |
{ | |
Bitmap bitmap = new Bitmap(1000, 1000); | |
using (Graphics g = Graphics.FromImage(bitmap)) | |
{ | |
g.Clear(Color.White); | |
for (int i = 50; i < 900; i += 200) | |
{ | |
for (int j = 50; j < 900; j += 200) | |
{ | |
if (RND.Next(2) == 1) g.FillRectangle( | |
new SolidBrush(Color.FromArgb((int)(RND.NextDouble() * 255), Color.Black)), | |
new Rectangle(i, j, 100, 100)); | |
} | |
} | |
} | |
bitmap.Save($@"C:\Users\xdisplay\Desktop\TestImages\{k}.png"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment