How about netpbm? Convert to ppm image. Then read in with python
program to work out how close on average each pixel is to 0,0,0 or
255,255,255.

Cheers,
Carl.

On 10/10/06, Andrew Errington <[EMAIL PROTECTED]> wrote:
Hi,

Can anyone comment knowledgably on determining the light level in a JPG
image snapped by a webcam?

I have the simple requirement of taking hourly snapshots from my webcam in
the back garden and posting them on my webpage.  At the moment I have a
cron job, which I tweak during the year to adjust when it takes a picture
(i.e from 8 to 5 in winter to 5 till 10 in summer), but really it should be
automated.  I could rig up a light sensor, and the PC could query it before
taking a webcam image, but really, the webcam itself is a light sensor
(duh!).

I am thinking of the imagemagick 'identify' command, and maybe extracting
the mean value of the red, green and blue channels and comparing them to a
hard limit.  Does this idea have merit, or is there a better tool?

I could also just look at the file size: at night the images are mostly
black, which compresses to a very small file size.

Comments are welcome,

Thanks,

Andrew

Reply via email to