Skip to content

Instantly share code, notes, and snippets.

@shuuuuun
Created February 10, 2020 11:25
Show Gist options
  • Save shuuuuun/09d632e59aeb022384488b2a10f661ef to your computer and use it in GitHub Desktop.
Save shuuuuun/09d632e59aeb022384488b2a10f661ef to your computer and use it in GitHub Desktop.
# headless chromeでスクリーンショットを撮るやつ
# ref. https://developers.google.com/web/updates/2017/04/headless-chrome?hl=ja
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
# shot!
chrome --headless --disable-gpu --screenshot="./screenshot/hoge.png" --window-size=1280,4000 https://example.com/hoge
# shot!shot!shot!
pages=(hoge fuga piyo)
for page in ${pages}; do
url="https://example.com/${page}"
echo "capturing: ${url}"
chrome --headless --disable-gpu --screenshot="./screenshot/${page}.png" --window-size=1280,4000 ${url}
done
# 重いので人に共有するときは圧縮したほうがいい
# pngquant --verbose --ext .png --force screenshot/*.png
# zip -r screenshot.zip screenshot/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment