Another main property of a color is brightness. We can change the brightness by brighten.
fn main() {
let img = image::open("my_image.jpg").unwrap();
let img2 = img.brighten(20);
img2.save("brighten_positive.jpg").unwrap();
let img3 = img.brighten(-20);
img3.save("brighten_negative.jpg").unwrap();
}When the parameter of brighten is positive, the brightness increases. On the other hand, when the parameter is negative, the brightness decreases.
Original image:
brighten_positive.jpg:
brighten_negative.jpg:
➡️ Next: Image Contrast
📘 Back: Table of contents


