• Android截图命令screencap


    查看帮助命令

    bixiaopeng@bixiaopeng ~$ adb shell screencap -v
    screencap: invalid option -- v
    usage: screencap [-hp] [-d display-id] [FILENAME]
       -h: this message
       -p: save the file as a png.
       -d: specify the display id to capture, default 0.
    If FILENAME ends with .png it will be saved as a png.
    If FILENAME is not given, the results will be printed to stdout.
    
    

    注意:

    如果文件名以.png结尾时,它将保存为png文件

    如果文件名没有给出,则结果被会被输出到stdout

    截图保存到SD卡里再导出

    $ adb shell screencap -p /sdcard/screen.png
    $ adb pull /sdcard/screen.png
    $ adb shell rm /sdcard/screen.png
    

    这种方法比较麻烦,需要3步:1. 截图保存到sdcard 2.将图片导出 3.删除sdcard中的图片

    截图直接保存到电脑

    $ adb shell screencap -p | sed 's/
    $//' > screen.png
    

    执行adb shell 将 转换 , 因此需要用sed删除多余的

    如果直接当命令用还可以用 alias 包裝装起來:

    $ alias and-screencap="adb shell screencap -p | sed 's/
    $//'"
    $ and-screencap > screen.png 
    

    以后就可以方便的用and-screencap > 直接将截图保存到电脑上了

  • 相关阅读:
    使用Koa搭建一个mock服务器
    d3 使用记录: 树形图
    转载: 矩阵的运算及运算规则
    d3 使用记录: 插值
    d3 使用记录: Selection
    转载: javascript 模块化历程
    Git 常用操作
    贝塞尔曲线_初探
    css 基础-
    Freemarker模板语法
  • 原文地址:https://www.cnblogs.com/jinjiangongzuoshi/p/5002348.html
Copyright © 2020-2023  润新知