import os import subprocess import glob CAND = [r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", r"C:\Program Files\Microsoft\Edge\Application\msedge.exe"] EDGE = next((c for c in CAND if os.path.exists(c)), None) if not EDGE: EDGE = glob.glob(r"C:\Users\*\AppData\Local\Microsoft\Edge\*\msedge.exe")[0] HTML = r"G:/Robot_v2/机器人手臂/web/机器人手臂3D查看器.html" ART = r"C:/Users/cbb/.gemini/antigravity/brain/5b3fdbf8-960a-428d-b114-f1ec3e9a8af3" shots = [ ("shot_p07_az0", "?az=0&po=1.5708&rd=220&tx=18.5&ty=250&tz=-140&xray=0"), ("shot_p07_az90", "?az=1.5708&po=1.5708&rd=220&tx=18.5&ty=250&tz=-140&xray=0"), ("shot_p07_az180", "?az=3.14159&po=1.5708&rd=220&tx=18.5&ty=250&tz=-140&xray=0"), ("shot_p07_azneg90", "?az=-1.5708&po=1.5708&rd=220&tx=18.5&ty=250&tz=-140&xray=0"), ] for nm, q in shots: out = os.path.join(ART, f"{nm}.png") target = f"file:///{HTML}{q}&still=1" cmd = [EDGE, "--headless=new", "--use-gl=angle", "--use-angle=d3d11", "--disable-cache", "--disable-application-cache", "--disk-cache-size=0", "--enable-gpu-rasterization", "--ignore-gpu-blocklist", "--hide-scrollbars", "--force-device-scale-factor=1", "--window-size=1200,900", "--virtual-time-budget=5000", f"--screenshot={out}", target] subprocess.run(cmd, capture_output=True, timeout=30) print(f"{nm}: size={os.path.getsize(out) if os.path.exists(out) else 0}")