Skip to content

Instantly share code, notes, and snippets.

@kasramp
Created August 2, 2020 10:56
Show Gist options
  • Save kasramp/4ed34c9a5cd2cfc464443f48b9b52ad2 to your computer and use it in GitHub Desktop.
Save kasramp/4ed34c9a5cd2cfc464443f48b9b52ad2 to your computer and use it in GitHub Desktop.
private void brightnessDown(PictureBox picImp) {
int[] RGB = new int[3];
for (int i = 0; i <= x.Width - 1; i++) {
for (int j = 0; j <= x.Height - 1; j++) {
z = x.GetPixel(i, j);
RGB[0] = (z.R) - 15;
RGB[1] = (z.G) - 15;
RGB[2] = (z.B) - 15;
if (RGB[0] < 0) {
RGB[0] = 0;
}
if (RGB[1] < 0) {
RGB[1] = 0;
}
if (RGB[2] < 0) {
RGB[2] = 0;
}
y.SetPixel(i, j, Color.FromArgb(RGB[0], RGB[1], RGB[2]));
}
}
Message.setMessage(PicSave.savechange(picImp, y), "Brightness Down");
}
private void brightnessUp(PictureBox picImp) {
int[] RGB = new int[3];
for (int i = 0; i <= x.Width - 1; i++) {
for (int j = 0; j <= x.Height - 1; j++) {
z = x.GetPixel(i, j);
RGB[0] = (z.R) + 15;
RGB[1] = (z.G) + 15;
RGB[2] = (z.B) + 15;
if (RGB[0] > 255) {
RGB[0] = 255;
}
if (RGB[1] > 255) {
RGB[1] = 255;
}
if (RGB[2] > 255) {
RGB[2] = 255;
}
y.SetPixel(i, j, Color.FromArgb(RGB[0], RGB[1], RGB[2]));
}
}
Message.setMessage(PicSave.savechange(picImp, y), "Brightness Up");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment