Skip to content

Instantly share code, notes, and snippets.

@fiskurgit
Last active January 15, 2016 21:30
Show Gist options
  • Save fiskurgit/32c6a729174fffe5abfc to your computer and use it in GitHub Desktop.
Save fiskurgit/32c6a729174fffe5abfc to your computer and use it in GitHub Desktop.
Pass image resize width argument to the Android screenshot.sh script: screenshot.sh 480 open
#!/bin/sh
width=$1
openInPreview=$2
timestamp=$(date +%s)
filepath=/sdcard/$timestamp.png
echo $filepath
adb shell screencap -p $filepath
adb pull $filepath
adb shell rm $filepath
sips --resampleWidth $width $timestamp.png
if [ "$openInPreview" = "open" ] ; then
open $timestamp.png
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment