Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

2.0 KB
Raw Blame
"""Store screenshots: the app's screen on a Linedesk-ink background with a short caption on top."""
import sys
from PIL import Image, ImageDraw, ImageFont

FONT = sys.argv[1]
SRC, OUT = sys.argv[2], sys.argv[3]
INK, PAPER, GREEN = (0x1C, 0x19, 0x17), (0xFA, 0xFA, 0xF8), (0x4A, 0xDE, 0x80)

CAPTIONS = {
    '1-inbox': ('Every call, sorted', 'What needs you comes first.'),
    '2-call': ('Know what they wanted', 'A summary and the next step for each call.'),
    '3-contacts': ('Your callers, remembered', 'Every caller with their calls and notes.'),
    '4-insights': ('Never miss a call', 'See what your assistant answered for you.'),
    '5-assistant': ('Your AI assistant', 'Answers when you can’t, day and night.'),
}


def frame(name, size):
    w, h = size
    canvas = Image.new('RGB', (w, h), INK)
    d = ImageDraw.Draw(canvas)
    title, sub = CAPTIONS[name]
    tf = ImageFont.truetype(FONT, int(w * 0.072))
    sf = ImageFont.truetype(FONT.replace('600', '400'), int(w * 0.04))
    top = int(h * 0.06)
    tw = d.textlength(title, font=tf)
    d.text(((w - tw) / 2, top), title, font=tf, fill=PAPER)
    sw = d.textlength(sub, font=sf)
    d.text(((w - sw) / 2, top + int(w * 0.105)), sub, font=sf, fill=(0xC8, 0xC5, 0xC0))
    # A small green dot, the brand's "live" mark, above the title.
    r = int(w * 0.012)
    d.ellipse((w / 2 - r, top - 3 * r, w / 2 + r, top - r), fill=GREEN)
    shot = Image.open(f'{SRC}/{name}.png').convert('RGB')
    area_top = top + int(w * 0.2)
    scale = 0.84
    sw_, sh_ = int(w * scale), int(shot.height * (w * scale) / shot.width)
    shot = shot.resize((sw_, sh_), Image.LANCZOS)
    # Rounded corners, like a phone screen.
    mask = Image.new('L', (sw_, sh_), 0)
    ImageDraw.Draw(mask).rounded_rectangle((0, 0, sw_, sh_), radius=int(w * 0.06), fill=255)
    canvas.paste(shot, ((w - sw_) // 2, area_top), mask)
    canvas.save(f'{OUT}/{name}.png')


import os

os.makedirs(OUT, exist_ok=True)
size = Image.open(f'{SRC}/1-inbox.png').size
for n in CAPTIONS:
    frame(n, size)
print('ok', size)