cliでのウェブスクリーンショットが簡単で便利

「webkit2png」コマンドラインでウェブスクリーンショットを使えるツール

webkit2png GitHub

幾つかあるcliでのスクリーンショットツールのなかでインストールも簡単で使いやすい

連続処理や自前のウェブサービスに利用したり、DropBoxなどのウェブストレージにアップすればマーケティング・開発などチームでの仕事も捗るなど工夫しだいで大分効率があがりそうです

インストール方法

brew install webkit2png
#OS-Xなどで/usr/local/binにインストールされた場合
sudo chmod a+x /path/to/webkit2png

使い方

webkit2png http://blog.clockwise.ne.jp
オプション無しのデフォルトではトリミング画像、全体画像、サムネール画像の3画像が生成される

その他ブラウザサイズや書き出し画像のピクセルサイズ、読み込みのディレイなどの設定可能。

ヘルプ内容

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit

  Network Options:
    --timeout=TIMEOUT   page load timeout (default: 60)
    --user-agent=USER_AGENT
                        set user agent header
    --ignore-ssl-check  ignore SSL Certificate name mismatches

  Browser Window Options:
    -W WIDTH, --width=WIDTH
                        initial (and minimum) width of browser (default: 800)
    -H HEIGHT, --height=HEIGHT
                        initial (and minimum) height of browser (default: 600)
    -z ZOOM, --zoom=ZOOM
                        zoom level of browser, equivalent to "Zoom In" and
                        "Zoom Out" in "View" menu (default: 1.0)
    --selector=SELECTOR
                        CSS selector for a single element to capture (first
                        matching element will be used)

  Output size options:
    -F, --fullsize      only create fullsize screenshot
    -T, --thumb         only create thumbnail sreenshot
    -C, --clipped       only create clipped thumbnail screenshot
    --clipwidth=WIDTH   width of clipped thumbnail (default: 200)
    --clipheight=HEIGHT
                        height of clipped thumbnail (default: 150)
    -s SCALE, --scale=SCALE
                        scale factor for thumbnails (default: 0.25)

  Output filename options:
    -D DIR, --dir=DIR   directory to place images into
    -o NAME, --filename=NAME
                        save images as NAME-full.png,NAME-thumb.png etc
    -m, --md5           use md5 hash for filename (like del.icio.us)
    -d, --datestamp     include date in filename

  Web page functionality:
    --delay=DELAY       delay between page load finishing and screenshot
    --js=JS             JavaScript to execute when the window finishes
                        loading(example: --js='document.bgColor="red";'). If
                        you need to wait for asynchronous code to finish
                        before capturing the screenshot, call
                        webkit2png.stop() before the async code runs, then
                        webkit2png.start() to capture the image.
    --no-images         don't load images
    --no-js             disable JavaScript support
    --transparent       render output on a transparent background (requires a
                        web page with a transparent background)