Flipping and Tiling Images with C#
I needed to create seamless textures for backgrounds in my game Maze Gun. So I whipped up a quick program in C# that does it for me.
Pastebin here of the code.
To use it, you need to create a Console Application Visual Studio project. Then, you need to add reference System.Drawing, and I think there’s another System.Drawing.<something> too. Then, copy paste code into Program.cs, edit the variables at the top, and have fun.
Here’s an image I wanted to tile
Here’s the result of tiling it
Obviously you could do this in Photoshop, but I did it to like 100 images in a few seconds, so it was quicker for me this way.
One thing I will probably add later on is recursion through all child folders to find files. I probably won’t post about it again though, so you’re on your own unless you need help and contact me.
Edit: If you use it, you probably want to change the output from Png to Jpeg in the SaveBitmap part for filesize. Edit Edit: Jpg loses too much quality for my purposes. If you wanna reduce the size, you need to set the quality to high on the graphics object like this
g.InterpolationMode = InterpolationMode.High;
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;