INNER CODE UNIT · Python

image_size

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

            image_size = (crop[2] - crop[0], crop[3] - crop[1])
            image = image.resize(image_size)
            expanded_crop = (crop[0], crop[1], crop[2], crop[3])
            expanded_size = (meta['size'][0], meta['size'][1])
            with Image.new('RGBA', expanded_size, (0, 0, 0, 0)) as expanded:
                expanded.paste(image, expanded_crop)
                expanded.save(tga_file)
        else:
            image.save(tga_file)

def zip(args):
    if not os.path.isdir(args.directory):
        print >> sys.stderr, '\'{}\' does not exist or is not a directory\n'.format(args.directory)
        sys.exit(1)
    tga_files = [f for f in os.listdir(args.directory) if os.path.isfile(os.path.join(args.directory, f)) and os.path.splitext(f)[1].lower() == '.tga']
    if not tga_files:
        print >> sys.stderr, '\'{}\' does not contain any TGA files\n'.format(args.directory)
        sys.exit(1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…