Check if image is black
Question: I'm running a Python script under Windows which deals with 480x800 `PNG`
images with 32-bit depth. I need to check if the given image is fully black or
not. After some searching I've found that ImageMagick could help me to achieve
this but unfortunately there's no manual for such task.

So a more general question is how to check if the image consists only of one
color?

**Edit:**

My apologies for not providing all the information about the environment from
beginning. The python script is executed using Android's
[`monkeyrunner`](http://developer.android.com/tools/help/monkeyrunner_concepts.html).
Since it uses it's own instance of Jython (version 2.5) it's not possible to
use any modules from external libraries. Inside there's a `MonkeyImage` class
to work with screenshots taken from the device. So I adopted @eumiro's answer
for it.


Answer: 
    import Image
    im = Image.load("image.png")
    diff_colors = list(set(im.getdata()))
    if len(diff_colors) == 1 and diff_colors[0] == (0, 0, 0):
        print "all black"
    

**EDIT** as @JonClements proposes, this will be faster and stop as soon as
anything else than black is found:

    
    
    import Image
    im = Image.load("image.png")
    if all(rgb == (0,0,0) for rgb in im.getdata()):
        print "all black"
    

