INNER CODE UNIT · Python

box

utopia-rise/godot-jvm · logo/export.py:236

        box = alpha.crop((0, y, logo.width, y + 1)).getbbox()
        if box and box[2] - box[0] > logo.width * 0.3:
            return (y + logo.height) / 2 / logo.height
    sys.exit('Could not locate the mascot head in highres/logo-1024.png')

def paste_logo(bg, logo, head_center, x, y):
    """Paste the logo so the mascot's head (ignoring the smoke) is centered on (x, y)."""
    logo = logo.resize((int(logo.width * LOGO_HEIGHT / logo.height), LOGO_HEIGHT), Image.Resampling.LANCZOS)
    y -= int((head_center - 0.5) * LOGO_HEIGHT)
    shadow = Image.new('RGBA', (logo.width + 200, logo.height + 200), (0, 0, 0, 0))
    tint = Image.new('RGBA', logo.size, (5, 3, 20, 190))
    tint.putalpha(logo.getchannel('A'))
    shadow.alpha_composite(tint, (100, 130))
    shadow = shadow.filter(ImageFilter.GaussianBlur(40))
    bg.alpha_composite(shadow, (x - shadow.width // 2, y - shadow.height // 2))
    bg.alpha_composite(logo, (x - logo.width // 2, y - logo.height // 2))

def compose(logo, head_center, rows, text_width, name):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…