Automate a screen capture?

If Microsoft's new browser testing/automation library Playwright installs on a Raspberry, it might be quite a straightforward route for getting the screenshot. You would create a standalone Node.js script to do that, then use exec node to run it.

Here's an example code snippet from their documentation you could adapt to your needs:

const { webkit } = require('playwright');  // Or 'chromium' or 'firefox'.

(async () => {
  const browser = await webkit.launch();
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('https://example.com');
  await page.screenshot({path: 'screenshot.png'});
  await browser.close();
})();