Last active
August 29, 2015 14:08
-
-
Save petitviolet/04654990fa54c0c5b130 to your computer and use it in GitHub Desktop.
adb経由でscreenshotを撮る
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
#!/bin/sh | |
DATE_TIME=`date +"%Y%m%d-%H%M%S"` | |
FILE_NAME=${DATE_TIME}.png | |
TARGET_PATH="./" | |
SIZE="x480" | |
USAGE=" | |
Usage: "`basename $0`" -t [target_path] -s [size]\n | |
options\n | |
-t: local file path for screen shot\n | |
-s: compress rate, using convert" | |
while getopts ht:s: option | |
do | |
case $option in | |
h) | |
echo $USAGE | |
exit 0;; | |
t) | |
TARGET_PATH=$OPTARG;; | |
s) | |
SIZE=$OPTARG;; | |
\?) | |
echo $USAGE | |
exit 1;; | |
esac | |
done | |
adb shell screencap -p /sdcard/$FILE_NAME | |
adb pull /sdcard/$FILE_NAME | |
adb shell rm /sdcard/$FILE_NAME | |
convert -resize $SIZE $FILE_NAME $FILE_NAME | |
mv ./$FILE_NAME $TARGET_PATH | |
echo screenshot saved to $TARGET_PATH/$FILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment