Android

一直很不明白一些工具(ASM,Android管理工具)是如何获取设备屏幕的,今天在运行Adnroid screen montor的时候,发现有个进程,于是就简单的-h了一哈~

1 shell@glass-1:/ $ screencap -h
2 usage: screencap [-hp] [-d display-id] [FILENAME]
3    -h: this message
4    -p: save the file as a png.
5    -d: specify the display id to capture, default 0.
6 If FILENAME ends with .png it will be saved as a png.
7 If FILENAME is not given, the results will be printed to stdout.
8 1|shell@glass-1:/ $ 

这是一个截屏的工具,我猜大部分工具都是靠这命令获取屏幕图片的,

一般情况下,我们只需要-p参数就好了

1 $ screencap -p /sdcard/test.png

会把当前屏幕保存到SD卡下的test.png文件里,我们直接

1 $ adb pull /sdcard/test.png

就可以拿出来用了

原文地址:https://www.cnblogs.com/ch3rry/p/3871168.html