Question: My goal is to be able to type a one word command and get a screenshot from a rooted Nexus One attached by USB.

So far, I can get the framebuffer which I believe is a `32bit xRGB888` raw image by pulling it like this:

```
adb pull /dev/graphics/fb0 fb0

```

From there though, I'm having a hard time getting it converted to a png. I'm trying with ffmpeg like this:

```
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb8888 -s 480x800 -i fb0 -f image2 -vcodec png image.png

```

That creates a lovely purple image that has parts that vaguely resemble the screen, but it's by no means a clean screenshot.

Answer: 
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 fb0
dd bs=1920 count=800 if=fb0 of=fb0b
ffmpeg -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 fb0
dd bs=1920 count=800 if=fb0 of=fb0b
python rgb32torgb888.py <fb0b >fb0b.888
convert -depth 8 -size 480x800 RGB:fb0b.888 fb0.png

```

Python script 'rgb32torgb888.py':

```
import sys
while 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])

```
Now we have got a single line command to take a screenshot. The command as follows:

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

```

Type the above command in your terminal and press enter. If you want the screenshot to be stored in any specific location, then give the path (or) directory before `screen.png`.

[Source](http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html).