def create_cover(self, file_id, left, top, width, height):

        # The crop dimensions are given for the medium version.
        # Calculate them for the large version

        medium_img = Image.open(self._get_filename(file_id, 'medium'))
        medium_w, medium_h = medium_img.size

        large_img = Image.open(self._get_filename(file_id))
        large_w, large_h = large_img.size
        kw = {}
        if 'transparency' in large_img.info:
            kw['transparency'] = large_img.info["transparency"]

        left, width = int(float(left) * large_w / medium_w), int(float(width) * large_w / medium_w)
        top, height = int(float(top) * large_h / medium_h), int(float(height) * large_h / medium_h)

        n_img = large_img.crop((left, top, left + width, top + height))
        n_img.thumbnail(self.COVER_SIZE, Image.ANTIALIAS)
        n_img.save(self._get_filename(file_id, 'cover'), large_img.format, quality=75, **kw)
Create the cover version for a file
dataset/ETHPy150Open Net-ng/kansha/kansha/services/simpleassetsmanager/simpleassetsmanager.py/SimpleAssetsManager.create_cover