'(Consumer) Close the stream.
:returns: An image object.
:exception IOError: If the parser failed to parse the image file either
because it cannot be identified or cannot be
decoded.'

def close(self):

    if self.decoder:
        self.feed('')
        self.data = self.decoder = None
        if (not self.finished):
            raise IOError('image    was    incomplete')
    if (not self.image):
        raise IOError('cannot    parse    this    image')
    if self.data:
        with io.BytesIO(self.data) as fp:
            try:
                self.image = Image.open(fp)
            finally:
                self.image.load()
    return self.image
