So I was looking for a way to easily take android screenshots in a lossless image format, since my OEM only does jpeg.
Didn't want to install another adware and wound up with the adb shell screencap command since I need the pictures on my PC anyways.
But instead of a nice one-liner like
adb shell screencap -p > screenshot.png
I need 3 lines in a bash script.
Can we please just end the line ending wars?

  • 2
    I know it sucks ass.
    Also fuck the whole CL or RF or CLRF shit.
  • 3
    Any difference via cygwin or wsl?
  • 1
    @SortOfTested those might be worth a shot, or hell even the mingw bash that is installed with Git on windows.
  • 0

    Don't have cygwin, I have a linux VM (not wsl because wsl broke, I set up the VM and now that wsl2 is out I'm too lazy to migrate back) but USB debugging requires adb to run on the host so... (If only Hyper-V had USB passthrough like VirtualBox)

    Tried git bash, no luck there, and I'm pretty sure the fault lies within adb itself anyways. I tried

    ssh me@windows "adb shell screencap -p" > screenshot.png

    from linux and the png still comes out invalid.

    Maybe debugging over the network and running adb in linux could work? No Idea how to set that up tho
  • 0
    Update: Network debugging is as easy as pie. I can now wirelessly remote control my unrooted phone with github.com/oberien/adb-remote-control from linux (Nevermind the 1fps and no downsampling). And adb screencap -p | display png:- works too!
Add Comment