1

Is it posible to get average color (or more) of the computer screen in real time on a Mac?

For example, if I'm watching this site it will probably be white. I'm trying to make very simple ambient light with Arduino.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ajitam
  • 371
  • 3
  • 16

1 Answers1

0

I'm not a Mac developer, so I may be off the mark here, but I doubt Mac OS X provides a method specifically to get the average color of the screen. What you could do is take a screenshot and resize it down to one pixel using Core Image, which should efficiently (using hardware acceleration where available) calculate the average.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Wyzard
  • 33,849
  • 3
  • 67
  • 87
  • Hmm didn't think of this. If nothing else will be posible I will try it. – ajitam Nov 30 '10 at 14:47
  • @ajitam See [this answer](http://stackoverflow.com/questions/12147779/how-do-i-release-a-cgimageref-in-ios/12148136#12148136) for a similar approach. It's about four times faster than iterating over pixel data. – Nikolai Ruhe Aug 28 '12 at 11:59