Skip to content

Instantly share code, notes, and snippets.

@bradmartin333
Created July 16, 2022 11:41
Show Gist options
  • Save bradmartin333/da73bdd3f7c5acb2192222a68c63b757 to your computer and use it in GitHub Desktop.
Save bradmartin333/da73bdd3f7c5acb2192222a68c63b757 to your computer and use it in GitHub Desktop.
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