#!/usr/bin/env python3
"""Render 1:1 product creative, 2x DPR -> 2160x2160."""
from playwright.sync_api import sync_playwright

URL = 'http://localhost:8767/banner.html'
OUT = '/root/.hermes/image_cache/zrd_1x1/creative_1x1.png'

with sync_playwright() as p:
    b = p.chromium.launch(args=['--no-sandbox', '--force-color-profile=srgb'])
    pg = b.new_page(viewport={'width': 1080, 'height': 1080}, device_scale_factor=2)
    pg.goto(URL, wait_until='networkidle')
    pg.wait_for_timeout(500)
    pg.screenshot(path=OUT, clip={'x': 0, 'y': 0, 'width': 1080, 'height': 1080})
    b.close()
print('saved', OUT)
