There is no automated way to do this. You would need to analyze the histogram to determine whether it is weighted more towards 0 (dark) or 255 (light).
You could also try just getting the average color of the image:
I tried that but still cannot get to know whether an Image is lighter or darker.
If I calculate total pixels in a Historgram Gray channel it seems I am probably getting somewhere but I don't know as how accurate this may be.
What I am doing is calculating total pixels in all levels from 0 to 128 as these are generally dark and then calculating total pixels in all levels from 129 to 255 as these are Light.