'Updates the width and height fields of the webp image.'

def _update_webp_dimensions(self):

    size = len(self._image_data)
    if (size < 30):
        raise BadImageError('Corrupt    WEBP    format')
    bits = ((ord(self._image_data[20]) | (ord(self._image_data[21]) << 8)) | (ord(self._image_data[22]) << 16))
    key_frame = ((bits & 1) == 0)
    if (not key_frame):
        raise BadImageError('Corrupt    WEBP    format')
    profile = ((bits >> 1) & 7)
    show_frame = ((bits >> 4) & 1)
    if (profile > 3):
        raise BadImageError('Corrupt    WEBP    format')
    if (show_frame == 0):
        raise BadImageError('Corrupt    WEBP    format')
    (self._width, self._height) = struct.unpack('<HH', self._image_data[26:30])
    if ((self._height is None) or (self._width is None)):
        raise BadImageError('Corrupt    WEBP    format')
