@cached_property
    def image(self):
        """Return a Pil representation of this image """

        if sys.version < '3':
            imageio = StringIO.StringIO(self._image_data)
        else:
            imageio = StringIO.BytesIO(self._image_data)

        try:
            source_image = PILImage.open(imageio)
            img = PILImage.new('RGBA', source_image.size, (0, 0, 0, 0))

            if source_image.mode == 'L':
                alpha = source_image.split()[0]
                transparency = source_image.info.get('transparency')
                mask = PILImage.eval(alpha, lambda a: 0 if a == transparency else 255)
                img.paste(source_image, (0, 0), mask=mask)
            else:
                img.paste(source_image, (0, 0))
        except __HOLE__, e:
            raise PILUnavailableError(e.args[0].split()[1])
        finally:
            imageio.close()

        self.original_width, self.original_height = img.size

        # Crop the image searching for the smallest possible bounding box
        # without losing any non-transparent pixel.
        # This crop is only used if the crop flag is set in the config.
        if self.config['crop']:
            img = img.crop(img.split()[-1].getbbox())
        return img
dataset/ETHPy150Open jorgebastida/glue/glue/core.py/Image.image