{"id":71631,"date":"2024-04-04T18:00:11","date_gmt":"2024-04-04T10:00:11","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=71631"},"modified":"2024-04-03T03:11:00","modified_gmt":"2024-04-02T19:11:00","slug":"mac-website-screenshot-cli","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/","title":{"rendered":"How to Capture Website&#8217;s Screenshot Using Command Line"},"content":{"rendered":"<p>I know what you\u2019re thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot using <a href=\"https:\/\/www.hongkiat.com\/blog\/mac-keyboard-shortcuts\/\">Mac\u2019s keyboard shortcut<\/a> or a <a href=\"https:\/\/www.hongkiat.com\/blog\/free-screen-capturing-tools\/\">screenshot tool<\/a>?<\/p>\n<p>Well, couple of reasons really.<\/p>\n<p>Firstly, it\u2019s genuinely enjoyable and useful to know. Secondly, using command lines allows for automation. You can duplicate commands, compile them into a script, and run it to batch capture screenshots of predetermined websites or URLs.<\/p>\n<p>To take a screenshot on your Mac using the command line, here\u2019s how to do it. Start by opening the Terminal app (duh!)<\/p>\n<p>Next, you\u2019ll need to adjust the following command to specify two key things:<\/p>\n<ol>\n<li>your screenshot\u2019s saved location and its filename, and <\/li>\n<li>the URL of the website you want to capture.<\/li>\n<\/ol>\n<pre>\r\n\/Applications\/Google\\ Chrome.app\/Contents\/MacOS\/Google\\ Chrome \\\r\n  --headless \\\r\n  --screenshot=<strong>\/path\/to\/screenshot\/image.png<\/strong> \\\r\n  <strong>https:\/\/www.domain.com<\/strong>\r\n<\/pre>\n<p>Let\u2019s walk through an example. If you want to capture a screenshot of <strong>apple.com<\/strong>, name it \"<strong>apple.jpg<\/strong>\", and save it to a folder named \"<strong>screenshots<\/strong>\", this is how your command would look:<\/p>\n<pre>\r\n\/Applications\/Google\\ Chrome.app\/Contents\/MacOS\/Google\\ Chrome \\\r\n  --headless \\\r\n  --screenshot=<strong>\/screenshots\/apple.png<\/strong> \\\r\n  <strong>https:\/\/www.apple.com<\/strong>\r\n<\/pre>\n<p>And this is what the screenshot will look like:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg\" alt=\"Standard apple.com screenshot\" width=\"1600\" height=\"1200\"><\/figure>\n<p>If you wish to customize the screenshot\u2019s dimensions, you can do so by adding the following parameter:<\/p>\n<pre>--window-size=WIDTH,HEIGHT <\/pre>\n<p>For instance, to capture a screenshot of apple.com at a resolution of <strong>450\u00d7800<\/strong>, your command should be formatted as follows:<\/p>\n<pre>\r\n\/Applications\/Google\\ Chrome.app\/Contents\/MacOS\/Google\\ Chrome \\\r\n  --headless \\\r\n  <strong>--window-size=450,800 \\<\/strong>\r\n  --screenshot=\/screenshots\/apple.png \\\r\n  https:\/\/apple.com\r\n<\/pre>\n<p>And here\u2019s the resulting image:<\/p>\n<figure class=\"screenshot-mobile-portrait\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot-custom-size.png\" alt=\"Custom-size apple.com screenshot\" width=\"900\" height=\"1600\"><\/figure>","protected":false},"excerpt":{"rendered":"<p>I know what you\u2019re thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot using Mac\u2019s keyboard shortcut or a screenshot tool? Well, couple of reasons really. Firstly, it\u2019s genuinely enjoyable and useful to know. Secondly, using command lines allows for&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3397],"tags":[3053,3933],"topic":[],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Capture Website&#039;s Screenshot Using Command Line - Hongkiat<\/title>\n<meta name=\"description\" content=\"I know what you&#039;re thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Capture Website&#039;s Screenshot Using Command Line\" \/>\n<meta property=\"og:description\" content=\"I know what you&#039;re thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-04T10:00:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg\" \/>\n<meta name=\"author\" content=\"Hongkiat Lim\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hongkiat Lim\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/\"},\"author\":{\"name\":\"Hongkiat Lim\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e3613a3bf757e4f67770f0b7a339edd0\"},\"headline\":\"How to Capture Website&#8217;s Screenshot Using Command Line\",\"datePublished\":\"2024-04-04T10:00:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/\"},\"wordCount\":228,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mac-website-screenshot-cli\\\/apple-screenshot.jpg\",\"keywords\":[\"Command Line\",\"macOS\"],\"articleSection\":[\"Desktop\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/\",\"name\":\"How to Capture Website's Screenshot Using Command Line - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mac-website-screenshot-cli\\\/apple-screenshot.jpg\",\"datePublished\":\"2024-04-04T10:00:11+00:00\",\"description\":\"I know what you're thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mac-website-screenshot-cli\\\/apple-screenshot.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mac-website-screenshot-cli\\\/apple-screenshot.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/mac-website-screenshot-cli\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Capture Website&#8217;s Screenshot Using Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e3613a3bf757e4f67770f0b7a339edd0\",\"name\":\"Hongkiat Lim\",\"description\":\"Founder and Editor in Chief of Hongkiat.com. Hongkiat is also a designer, developer, entrepreneur, and an active investor in the US stock market.\",\"sameAs\":[\"http:\\\/\\\/www.hongkiat.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/hongkiat\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Capture Website's Screenshot Using Command Line - Hongkiat","description":"I know what you're thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/","og_locale":"en_US","og_type":"article","og_title":"How to Capture Website's Screenshot Using Command Line","og_description":"I know what you're thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot","og_url":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2024-04-04T10:00:11+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg","type":"","width":"","height":""}],"author":"Hongkiat Lim","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Hongkiat Lim","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/"},"author":{"name":"Hongkiat Lim","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e3613a3bf757e4f67770f0b7a339edd0"},"headline":"How to Capture Website&#8217;s Screenshot Using Command Line","datePublished":"2024-04-04T10:00:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/"},"wordCount":228,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg","keywords":["Command Line","macOS"],"articleSection":["Desktop"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/","url":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/","name":"How to Capture Website's Screenshot Using Command Line - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg","datePublished":"2024-04-04T10:00:11+00:00","description":"I know what you're thinking: why bother with the command line for screenshots when I can just navigate to the website via a browser and take a screenshot","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/mac-website-screenshot-cli\/apple-screenshot.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/mac-website-screenshot-cli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Capture Website&#8217;s Screenshot Using Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e3613a3bf757e4f67770f0b7a339edd0","name":"Hongkiat Lim","description":"Founder and Editor in Chief of Hongkiat.com. Hongkiat is also a designer, developer, entrepreneur, and an active investor in the US stock market.","sameAs":["http:\/\/www.hongkiat.com\/blog"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/hongkiat\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-iDl","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/71631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=71631"}],"version-history":[{"count":2,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/71631\/revisions"}],"predecessor-version":[{"id":71633,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/71631\/revisions\/71633"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=71631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=71631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=71631"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=71631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}