'Updates the width and height fields of the gif image.
Raises:
BadImageError if the image string is not a valid gif image.'

def _update_gif_dimensions(self):

    size = len(self._image_data)
    if (size >= 10):
        (self._width, self._height) = struct.unpack('<HH', self._image_data[6:10])
    else:
        raise BadImageError('Corrupt    GIF    format')
