Skip to content

Instantly share code, notes, and snippets.

@kanzure
Created July 25, 2011 22:39
Show Gist options
  • Save kanzure/1105435 to your computer and use it in GitHub Desktop.
Save kanzure/1105435 to your computer and use it in GitHub Desktop.
droid2png - capture screenshots of your android progress
#!/bin/bash
#file: droid2png.sh
#author: Bryan Bishop <[email protected]>
#date: 2011-04-07
#license: gplv2+
#url: http://heybryan.org/
#example: http://heybryan.org/shots/2011-04-11-212956-hopper-progress.gif
if [[ "$1" == "" ]]; then echo "missing argument (output filename, .png)"; exit; fi;
outputpng=$1;
adb pull /dev/graphics/fb0 fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 320x480 -i fb0 -f image2 -vcodec png $outputpng
rm fb0
echo -e "\n\ncheck $outputpng"
#!/bin/bash
#file: shots/make_gif.sh
#author: Bryan Bishop <[email protected]>
#date: 2011-04-11
#license: gplv2+
#url: http://heybryan.org/
#example: http://heybryan.org/shots/2011-04-11-212956-hopper-progress.gif
#make an animation to show progress (if any)
folder=`date +"%Y-%m-%d-%H%M%S"`;
outputgif=$folder-hopper-progress.gif;
mkdir -p $folder;
cp -p *.png $folder/;
cd $folder;
#just in case..
rm output.gif
#get rid of some bad screenshots
rm 2011-04-09-151536.png
rm 2011-04-09-151957.png
rm 2011-04-09-1619-droid.png
#make the gif
convert -verbose -delay 20 -loop 0 -density 200 *.png $outputgif
#clean up the mess
rm *.png;
#move it up one directory
mv $outputgif ../;
#follow it
cd ../;
#upload it
scp -p $outputgif [email protected]:~/heybryan.org/shots/
#gimme a handy link
echo "http://heybryan.org/shots/$outputgif";
#!/bin/bash
#file: quickview.sh
#author: Bryan Bishop <[email protected]>
#date: 2011-04-07
#license: gplv2+
#url: http://heybryan.org/
#example: http://heybryan.org/shots/2011-04-11-212956-hopper-progress.gif
emulator=emulator-5554;
package=android.TestApp;
activity=com.android.TestApp;
project=TestApp;
#compile the app
ant debug
if [ $? -eq 0 ]; then
adb -s $emulator uninstall $package;
adb -s $emulator install bin/$project-debug.apk;
adb -s $emulator shell am start -a android.intent.action.MAIN -n $package/$activity;
which droid2png;
if [ $? -eq 0 ]; then
mkdir -p shots; #just in case
echo "Waiting for activity to finish starting, before taking a screenshot.";
sleep 5;
droid2png shots/`date +"%Y-%m-%d-%H%M%S"`.png;
#fi;
echo "starting logcat..."
adb -s $emulator logcat
fi;
echo "quickview: done";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment