'Allocates storage for the image and loads the pixel data.  In
normal cases, you don\'t need to call this method, since the
Image class automatically loads an opened image when it is
accessed for the first time. This method will close the file
associated with the image.
:returns: An image access object.
:rtype: :ref:`PixelAccess` or :py:class:`PIL.PyAccess`'

def load(self):

    if (self.im and self.palette and self.palette.dirty):
        self.im.putpalette(*self.palette.getdata())
        self.palette.dirty = 0
        self.palette.mode = 'RGB'
        self.palette.rawmode = None
        if ('transparency' in self.info):
            if isinstance(self.info['transparency'], int):
                self.im.putpalettealpha(self.info['transparency'], 0)
            else:
                self.im.putpalettealphas(self.info['transparency'])
            self.palette.mode = 'RGBA'
    if self.im:
        if (HAS_CFFI and USE_CFFI_ACCESS):
            if self.pyaccess:
                return self.pyaccess
            from . import PyAccess
            self.pyaccess = PyAccess.new(self, self.readonly)
            if self.pyaccess:
                return self.pyaccess
        return self.im.pixel_access(self.readonly)
