Created
February 10, 2020 11:25
-
-
Save shuuuuun/09d632e59aeb022384488b2a10f661ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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