I know what you’re taking into account: why bother with the command line for screenshots when I can merely navigate to the internet web page by the use of a browser and take a screenshot the usage of Mac’s keyboard shortcut or a screenshot software?
Neatly, couple of reasons really.
At the start, it’s in truth enjoyable and useful to know. Secondly, the usage of command traces shall we in for automation. You’ll have the ability to reproduction directions, compile them proper right into a script, and run it to batch grasp screenshots of predetermined internet websites or URLs.
To take a screenshot to your Mac the usage of the command line, proper right here’s do it. Get began by the use of opening the Terminal app (duh!)
Next, you’ll need to regulate the following command to specify two key problems:
- your screenshot’s saved location and its filename, and
- the URL of the internet web page you want to grasp.
/Methods/Google Chrome.app/Contents/MacOS/Google Chrome --headless --screenshot=/path/to/screenshot/image.png https://www.house.com
Let’s walk by means of an example. If you want to grasp a screenshot of apple.com, name it “apple.jpg“, and save it to a folder named “screenshots“, this is how your command would look:
/Methods/Google Chrome.app/Contents/MacOS/Google Chrome --headless --screenshot=/screenshots/apple.png https://www.apple.com
And that’s what the screenshot will seem to be:
![Standard apple.com screenshot](https://wpmountain.com/wp-content/uploads/2024/04/apple-screenshot.jpg)
If you wish to customize the screenshot’s dimensions, you’ll achieve this by the use of together with the following parameter:
--window-size=WIDTH,HEIGHT
For instance, to grasp a screenshot of apple.com at a resolution of 450&instances;800, your command must be formatted as follows:
/Methods/Google Chrome.app/Contents/MacOS/Google Chrome --headless --window-size=450,800 --screenshot=/screenshots/apple.png https://apple.com
And proper right here’s the following image:
![Custom-size apple.com screenshot](https://wpmountain.com/wp-content/uploads/2024/04/apple-screenshot-custom-size.jpg)
The put up How one can Seize Site’s Screenshot The usage of Command Line appeared first on Hongkiat.
Supply: https://www.hongkiat.com/blog/mac-website-screenshot-cli/
Contents
0 Comments