The Brightness effect can be used to lighten the image or to darken it.

The value given is added to every pixel in the image. The value may be negative in which case the result is to darken rather than lighten the image.

Syntax

[C#]

static void Brightness(Bitmap bitmap, double amount);

[Visual Basic]

Shared Sub Brightness(bitmap As Bitmap, amount As Double)
Params
Name Description
bitmap The bitmap to process
amount Amount to lighten or darken the image.
Notes

None.

Example

[C#]

using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/andreas-dress-Iw12lY3koDk-unsplash.jpg"))) {
  Effects.Brightness(bm, 20);
  bm.Save(Server.MapPath("IG8_Effects_Brightness1.jpg"));
}
using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/andreas-dress-Iw12lY3koDk-unsplash.jpg"))) {
  Effects.Brightness(bm, -20);
  bm.Save(Server.MapPath("IG8_Effects_Brightness2.jpg"));
}
using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/andreas-dress-Iw12lY3koDk-unsplash.jpg"))) {
  Effects.Brightness(bm, 60);
  bm.Save(Server.MapPath("IG8_Effects_Brightness3.jpg"));
}


Here we apply a brightness effect with different amounts of brightness. Ouput files are shown below.


andreas-dress-Iw12lY3koDk-unsplash.jpg


IG8_Effects_Brightness1.jpg


IG8_Effects_Brightness2.jpg


IG8_Effects_Brightness3.jpg