Created
November 12, 2016 12:00
-
-
Save michaelkl/111bcd8a6722172da84ee6aaf0fc2f1b to your computer and use it in GitHub Desktop.
screen brightness auto ajustment according to lighting (detected by webcam)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMPFILE=`mktemp /tmp/tmp.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.jpg` | |
fswebcam --jpeg 95 $TMPFILE | |
AVG=`convert $TMPFILE -format "%[mean]" info:` | |
BRIGHT=`echo $AVG | awk '{print int($1/65535*100+30)}'` | |
xbacklight -set $BRIGHT -time 2000 | |
rm -rf $TMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment