I wrote a quick python script to return the average colour of rectangles surrounding the perimeter of my screen. (The end goal here is to have RGB LED strips surrounding my moni
A quick win could be to use a resize
operation (in PIL) (you may use simple interpolation for speed) to a 5x5 image instead of averaging the regions, e.g.:
myimg = ImageGrab.grab()
resized = myimg.resize((5, 5), Image.NEAREST)
This should yield approximately the same effect as doing the averaging work yourself.
Not really sure about the speed of PIL's ImageGrab (and how it compares to autopy
) though, but it's easy enough to try and find out.