using global::System.Drawing; namespace Pilz.Drawing { public static class BitmapExtensions { public static void InvertColors(this Bitmap bmp) { for (int y = 0, loopTo = bmp.Height - 1; y <= loopTo; y++) { for (int x = 0, loopTo1 = bmp.Width - 1; x <= loopTo1; x++) { var inv = bmp.GetPixel(x, y); inv = Color.FromArgb(inv.A, byte.MaxValue - inv.R, byte.MaxValue - inv.G, byte.MaxValue - inv.B); bmp.SetPixel(x, y, inv); } } } } }