def open_image(image_path):
    try:
        im = Image.open(image_path)
    except IOError, e:
        if str(e) == "cannot identify image file":
            return None
        else:
            raise
    except:
        m = "caught exception identifying '%s', assuming non-image:\n%s"
        e = traceback.format_exc()
        warn(m, image_path, e)
        return None
    return im
Open an image file in PIL, return the Image object.
dataset/ETHPy150Open mikeorr/WebHelpers2/unfinished/multimedia.py/open_image