4

I'm using this command for screenshots:

chromium-browser --headless --screenshot https://www.google.com

From here.

This basically works:

[1101/145557.285618:ERROR:gpu_process_transport_factory.cc(980)] Lost UI shared context.
[1101/145558.357174:INFO:headless_shell.cc(538)] Written to file screenshot.png.

(It's well covered elsewhere, but I haven't found a useful fix for the Lost UI error. This is not relevant.)

How can I set the name of screenshot.png to be saved as something else?

I found a couple of rundowns of chrome command line switches, such as this one, but the most likely looking flag, "--output" was not relevant to screenshots.

If you have a better recommendation for headless or chromeless screenshots, that is as simple as this, I'm all ears.

Mittenchops
  • 18,633
  • 33
  • 128
  • 246

1 Answers1

11

--screenshot=filename.png.

Reference: https://cs.chromium.org/search/?q=symbol:kDefaultScreenshotFileName

Similarly, --print-to-pdf also accepts a filename.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275