INNER CODE UNIT · Python

right

TheAssemblyArmada/Vanilla-Conquer · scripts/tgautil.py:65

                    right = image.width - x
                    found_right = True
        tga_data = StringIO.StringIO()
        meta = None
        if left == 0 and top == 0 and right == image.width and bottom == image.height:
            image.save(tga_data, 'TGA')
        else:
            image.crop((left, top, right, bottom)).save(tga_data, 'TGA')
            meta = json.dumps({
                'size': [image.width, image.height],
                'crop': [left, top, right, bottom]
            }, separators=(',',':'))
        return (tga_data.getvalue(), meta)

def expand(tga_data, meta, tga_file):
    with Image.open(io.BytesIO(tga_data)) as image:
        if meta:
            crop = meta['crop']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…