Skip to content

Helvio88/web-screenshot

Repository files navigation

Build Status

web-screenshot

A tool to take screenshots of websites headlessly.

Installation

npm install -g @helvio/web-screenshot --unsafe-perm

--unsafe-perm is necessary to install puppeteer on your computer.

Usage

$ web-screenshot --help
Usage: screenshot [options]

Options:
  -V, --version          output the version number
  -u, --url <url>        URL (website) to screenshot
  -t, --time [s]         Number of seconds to wait for page to load (default: 3)
  -x, --x [x]            Leftmost Pixel (default: 0)
  -y, --y [y]            Top Pixel (default: 0)
  -w, --width [width]    Width (default: 1920)
  -h, --height [height]  Height (default: 1080)
  -o, --out [out]        Absolute or Relative Path to save the screenshot
  -c, --crop             Auto crop same-color borders
  -d, --debug            Prints debug messages
  -a, --auth [auth]      NTLM Credentials in username:password format
  --help                 display help for command

Tips

  • You can call web-screenshot with the URL only, such as web-screenshot -u github.com.
  • The program will append http:// to your URL and save the output file as github.com.png.
  • If width or height are 0, a Full Page screenshot is taken.
  • The base viewport is 1920x1080.
  • After the ScreenShot is taken, the borders can be cropped using --crop. Powered by Jimp.
  • You can screenshot just a rectangle (or clip) of a webpage by providing x, y, w and h, such as
web-screenshot -u https://google.com -x 700 -y 190 -w 700 -h 180 -o google_logo.png --crop

Coordinates are approximate and you can either use a tool to measure the pixels or trial and error.

The command outputs the image:

google_logo.png

google_logo.png

Happy Screenshotting!

About

Take a ScreenShot of a WebPage

Resources

Stars

Watchers

Forks

Packages

No packages published