Screenshot of the Nexus One from adb? Screenshot of the Nexus One from adb? android android

Screenshot of the Nexus One from adb?


A vastly easier solution for ICS is to use the following from the command line

adb shell /system/bin/screencap -p /sdcard/screenshot.pngadb pull /sdcard/screenshot.png screenshot.png

This'll save the screenshot.png file in the current directory.

Tested on a Samsung Galaxy SII & SII running 4.0.3.


Actually, there is another very simple ability to grab screenshot from your android device: write simple script 1.script like this:

# Imports the monkeyrunner modules used by this programfrom com.android.monkeyrunner import MonkeyRunner, MonkeyDevice# Connects to the current device, returning a MonkeyDevice objectdevice = MonkeyRunner.waitForConnection()# Takes a screenshotresult = device.takeSnapshot()# Writes the screenshot to a fileresult.writeToFile('1.png','png')

and call monkeyrunner 1.script.


It seems that frame buffer of N1 uses RGB32 encoding (32 bits per pixel).

Here is my script using ffmpeg:

adb pull /dev/graphics/fb0 fb0dd bs=1920 count=800 if=fb0 of=fb0bffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 480x800 -i fb0b -f image2 -vcodec png fb0.png

Another way derived from ADP1 method described here http://code.lardcave.net/entries/2009/07/27/132648/

adb pull /dev/graphics/fb0 fb0dd bs=1920 count=800 if=fb0 of=fb0bpython rgb32torgb888.py <fb0b >fb0b.888convert -depth 8 -size 480x800 RGB:fb0b.888 fb0.png

Python script 'rgb32torgb888.py':

import syswhile 1: colour = sys.stdin.read(4) if not colour:  break sys.stdout.write(colour[2]) sys.stdout.write(colour[1]) sys.stdout.write(colour[0])