0

The topic is less easy than it looks.

I need to be able to get png or jpg screenshot from some website on specific interval.

So a simple cron job is OK, but I can't find a tool that really works. I tried more than 10 that I found on google, but most of them are out of date or buggy, complaining that there is no more compatibility with current packages, etc.

For the ones which did work, the rendering is poor and do not consider Javascript or allow for certain JS events to trigger the screenshot. For instance, let's say I would like to capture the following a Google Maps page: https://www.google.com/maps/@46.9420866,8.5839928,14z.

I would like this page to be screenshotted repeatedly.

As mentioned in the title, I need a script or application: I can't use an "end-user" software that will need interaction (such as classic screenshot tools).

If you know any tool that works with a current Debian (or any other Linux distro, for that matter) version, I'd greatly appreciate it!

0

3 Answers 3

2

Try headless Chrome.

The command is

chrome --headless --disable-gpu --screenshot https://www.example.com/

(the --disable-gpu flag is rarely needed, on on some Windows machines, I think)

Quoting from the documentation:

Running with --screenshot will produce a file named screenshot.png in the current working directory. If you're looking for full page screenshots, things are a tad more involved. There's a great blog post from David Schnurr that has you covered. Check out Using headless Chrome as an automated screenshot tool .

0

You don't say what you've tried and rejected, but if scrot isn't among those, it would seem to fulfill your needs. It can take a screenshot of a specific window, it has a configurable image quality level, and a cron job can be set up to take screenshots at a specific interval.

1
  • scrot is a real screenshot feature, but it requires GUI. Anyway thanks for the idea, i'll dig it
    – Micbol12
    May 13, 2019 at 6:11
0

Depending on how the site was built (ie, one of the javascript messes with angular,etc or just HTML) you could ...

use wget to mirror the page to a local file, along with all requisites (images, etc).

use one of the HTML -> PDF converters to create a PDF of the page.

use pdf2tiff to convert it to a TIFF image.

use whatever image utility (imagemagick/convert) to turn the TIFF into a PNG, JPG, etc.

Glue all of that together wiht some bash shell scripting or python or even php or whatever other reasonable programming language you are comfortable with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.