from playwright.sync_api import sync_playwright
from pathlib import Path

html_path = Path("/opt/mia/workspace/clientes/francisco_borrello/instagram/pendulo_art.html")
destino = "/opt/mia/workspace/clientes/francisco_borrello/instagram/pendulo_art.png"

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1080, "height": 1080})
    page.goto(f"file://{html_path}", wait_until="networkidle")
    page.wait_for_timeout(800)
    page.screenshot(path=destino, clip={"x": 0, "y": 0, "width": 1080, "height": 1080})
    browser.close()

print(f"OK -> {destino}")
