Tag: python imaging library

截面颜色平均矩形

我写了一个快速的python脚本来返回屏幕周边的矩形的平均颜色。 (这里的最终目标是在我的显示器周围放置RGB LED条 ,以便在电影期间获得发光效果 – 像这样(youtube) ,但更有趣,因为我自己制作它)。 我目前正在使用autopy将屏幕作为位图(“屏幕截图”),获取每个像素值以及RGB HEX转换。 简化版: step = 1 width = 5 height = 5 b = autopy.bitmap.capture_screen() for block in border_block(width, height): # for each rectangle around the perimeter of my screen R,G,B = 0,0,0 count = 0 for x in xrange(block.x_min, block.x_max, step): for y in xrange(block.y_min, block.y_max, step): […]