def imgarea(im, zeroel=None):
    """Returns the area of the image, as determined by checking against the 'zeroel'.
    i.e., the number of pixels that are != zeroel.
    If 'zeroel' is not given, it's determined from the image type.
    """
    zeros = {'L':0, '1':0, 'I':0, 'F': 0.0, 'RGB': (0,0,0), 'RGBA': (0,0,0,0)}
    if zeroel is None:
        zeroel = zeros[im.mode]
    nz = sum(1 for p in im.getdata() if p != zeroel)
    return nz