Take Full Webpage Screenshots on Mac via Command Line with webkit2png

Nov 27, 2022 - 3 Comments

Mac Terminal icon

Ever needed to take a full webpage scrolling screenshot on the Mac through the command line?

While there are various approaches to taking full webpage screenshots on a Mac easily with Firefox or another browser, and many ways to take screenshots on the Mac, including taking screenshots from the Terminal, none of the native options are quite as simple for capturing full page screenshots of websites as the simple approach offered on iPhone or iPad. But if you’re a Terminal user, you can accomplish the task pretty easily with a tool called webkit2png.

This is a commonly required task for web developers, designers, project managers, and many others.

How to Take Full Page Screenshots on Mac via Command Line

Using the webkit2png command line tool, you can capture full webpage screenshots on the Mac.

First you’ll need to install Homebrew on the Mac,

brew install webkit2png

Once installation of webkit2png has completed, you can take a full page screenshot with the following syntax in the command line:

webkit2png -F https://osxdaily.com

The -F flag specifies full page.

You can also specify the width of the browser screenshot in pixels by using -W like so:

webkit2png -F -W 1000 https://osxdaily.com

Important note about capturing screenshots of pages with lazy-loading images: If you are taking screenshots of a web page that uses lazy loading to speed up site loading and page speed, which is incredibly common on the modern web, most of the web page images will not be captured in the screenshot. To avoid that, you’d have to use another full page screenshot method on the Mac like what’s available with Firefox, Safari Developer Tools, or using the iPhone/iPad to take full webpage screenshots.

We covered this tool over a decade(!) ago, but the utility has evolved considerably since then, and the need for it has also increased, thus we’re covering it again and a bit more in depth.

Do you have another approach to taking full page screenshots either from Terminal or elsewhere on the Mac? Let us know in the comments.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

3 Comments

» Comments RSS Feed

  1. Bogdan says:

    Simple installation, without homebrew:

    sudo curl -L ‘https://raw.githubusercontent.com/paulhammond/webkit2png/master/webkit2png’ -o /usr/local/bin/webkit2png

    sudo chmod a+x /usr/local/bin/webkit2png

  2. DanOC says:

    The homebrew version of webkit2png has not been updated for recent macOS versions that use only python3.

    The webkit2png python script has /usr/bin/python hard-coded as the python interpreter to use, which is not installed by default on recent macOS versions.

    And if you try to run
    “python3 /opt/homebrew/bin/webkit2png”
    you’ll get python3 syntax errors that indicate the script uses obsolete python2 syntax.

    Solution:
    brew uninstall webkit2png

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site