def verify_image(filename_or_obj, format, resolution):
    width, height = resolution
    if format in RAW_FORMATS:
        size = (
                math.ceil(width / 32) * 32
                * math.ceil(height / 16) * 16
                * RAW_FORMATS[format]
                )
        if isinstance(filename_or_obj, str):
            stream = io.open(filename_or_obj, 'rb')
        else:
            stream = filename_or_obj
        stream.seek(0, os.SEEK_END)
        assert stream.tell() == size
    else:
        img = Image.open(filename_or_obj)
        assert img.size == resolution
        assert img.format.lower() == format.lower()
        img.verify()
Verify that the image in filename_or_obj has the specified format and
dataset/ETHPy150Open waveform80/picamera/tests/verify.py/verify_image