Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 981 Bytes

File metadata and controls

35 lines (22 loc) · 981 Bytes

Brightening Images

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:

my_image

brighten_positive.jpg:

brighten_positive

brighten_negative.jpg:

brighten_negative

➡️ Next: Image Contrast

📘 Back: Table of contents