Skip to content

Instantly share code, notes, and snippets.

@mag5323
Last active December 19, 2015 08:07
Show Gist options
  • Save mag5323/92620839460c24faf203 to your computer and use it in GitHub Desktop.
Save mag5323/92620839460c24faf203 to your computer and use it in GitHub Desktop.
Bitmap bmp1 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "STU.bmp");
Bitmap bmp2 = new Bitmap(256, 256);
Color myColor = new Color();
int T = 75;
for (int r = 0; r < bmp1.Height; r++) {
for (int c = 0; c < bmp1.Width; c++) {
myColor = bmp1.GetPixel(c, r);
if (myColor.G > T) {
bmp2.SetPixel(c, r, Color.FromArgb(255, 255, 255));
}
else {
bmp2.SetPixel(c, r, Color.FromArgb(0, 0, 0));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment