Pages

Monday, April 7, 2014

Grab Screenshot from Android device using Command line (adb)

The simple one liner will be:

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png

The above command:

1. Uses adb to grab the screenshot and sends binary data to stdout, which is then ...
2. ... appended to a file screen.jpg. The perl command in between converts CRLF to LF.

Source