AutoBrightness is a Python3/QT5 application for Linux that uses your webcam to adjust screen brightness.

This was a feature I really missed from OSX: automatic brightness adjustment depending on the light conditions. Though I guess that Apple machines have a dedicated sensor for this, I can’t access it in Linux and many other machines won’t have it anyway. But most machines have a webcam so I was wondering whether something similar can be achieved using a webcam.

Inspired by WildGuppy (a tool that does this for Ubuntu but not quite to my liking) I decided to write my own tool.

AutoBrightness takes snapshots at configurable intervals, measures the brightness from the picture and adjusts the screen’s brightness accordingly. Unlike WildGuppy, it requires no training (it learns this by monitoring your manual adjustments), disables itself at a low battery level (because the kernel will start dimming your screen) and also accounts for screen reflection in a dark environment (a changing screen content will brighten/darken things up/down).

Tip: I you’re worried about exposing your camera or usually have your webcam covered but still would like to use this tool: cover your webcam with writable tape (the milky kind) and the resulting picture will be extremely blurred but still good enough for brightness


- Python version 3
- PyQt5 (see note below)
- scrot (a command line application to take screenshots)
- fswebcam (a command line utility to access the webcam)


Open a terminal window and type:
sudo pip install

After installation you can start it by typing AutoBrightness in a terminal window. You’ll find an AutoBrightness.desktop inside the package (download) that you can use to start it via your desktop shell (or add it to your autostart applications). I personally start and stop it through a d-bus monitoring script at login or screen unlock.


Leaving the battery device path empty means that AutoBrightness does not use the battery capacity to turn itself off.

Most webcams will have some kind of autoexposure setting that is usually turned on. You might achieve better results if you turn this off using the fswebcam parameters setting. On my desktop I have to use -s “Exposure, Auto”=”Manual Mode” and on my laptop -s “Exposure, Auto Priority”=false.

You can get a list of available options for your webcam through fswebcam -list-controls.


Open a terminal window and type:
sudo pip uninstall AutoBrightness

Note: AutoBrightness requires PyQt5 but this is not checked during installation since it might result in duplicate PyQt5 installations. If you don’t have PyQt5 you can install it by opening a terminal window and typing (without the quotes): ‘sudo pip install pyqt5’