はじめに
bashコマンドで写真とか撮れないかなーって探してたらあったので使ってみた.
ImageSnapとは
ImageSnapはWebカメラから画像をキャプチャできるコマンドラインツール.
詳細
使ってみる
環境
- MacBook Pro 2016
- macOS Sierra
インストール
brewでインストールできる.
brew install imagesnap
ヘルプ
とりあえずimagesnap -h
USAGE: imagesnap [options] [filename] Version: 0.2.5 Captures an image from a video device and saves it in a file. If no device is specified, the system default will be used. If no filename is specfied, snapshot.jpg will be used. Supported image types: JPEG, TIFF, PNG, GIF, BMP -h This help message -v Verbose mode -l List available video devices -t x.xx Take a picture every x.xx seconds -q Quiet mode. Do not output any text -w x.xx Warmup. Delay snapshot x.xx seconds after turning on camera -d device Use named video device
写真を撮る
imagesnap -qw 1 snapshot.png
で写真が撮れる.
オプションはqとwを使っている.
qはリザルトとかの出力をなくす.wは写真を撮る時間をコマンド実行時から遅らせる.
今回は1秒遅らせた.(このオプションを付けないと画像が真っ暗になった.レンズのライトが着くタイミングとかなのかな…?)
何秒かごとに写真を撮る.
tオプションを付けることで何秒かごとに写真を撮ることができる.
imagesnap -t 1.00
で1秒ごとに写真を撮ることができる.
結果
open snapshot.png
で写真を開く.
こんな感じの写真が撮れた.
感想
後ろに居る人にバレずに写真を撮りたい時とかに使えそう.