Pillow ImageEnhance Brightness and Contrast: what is the best order to apply these two filters?

346 Views Asked by At

Looking at the Brightness and Contrast classes in ImageEnhance:

https://pillow.readthedocs.io/en/stable/reference/ImageEnhance.html

The image is in RGB mode, 8 bits per channel.

I could apply Brightness first, then Contrast to the same image. Or I could choose the opposite order.

Does it make a difference? If it does, is there a recommended order?

Would the recommendation change if the image was in L mode, 8 bits per pixel?

1

There are 1 best solutions below

0
RAI On

it depends on what you want to achieve. If you need to enhance the details then contrast first. If you need brightness overall then brightness first. According to docs brightness it'll make all pixels brighter/darker. Contrast will make the bright pixels brighter and the dark pixels darker, but middle gray values will keep unchanged.