naman14 / gnome-android-tool

Gnome shell extension for adb tools
73 stars 9 forks source link

Corrupted image #1

Open 5ulo opened 7 years ago

5ulo commented 7 years ago

Arch Linux (latest updates) Gnome Shell 3.24 Android 7.0

SED methot makes corrupted screenshot files on some linux distros. adb shell screencap -p | sed 's/\r$//' > screen.png The file was corrupted

$ exiftool screen2017-06-05-15\:56.png 
ExifTool Version Number         : 10.50
File Name                       : screen2017-06-05-15:56.png
Directory                       : .
File Size                       : 1565 kB
File Modification Date/Time     : 2017:06:05 15:56:55+02:00
File Access Date/Time           : 2017:06:05 15:56:53+02:00
File Inode Change Date/Time     : 2017:06:05 15:56:55+02:00
File Permissions                : rw-r--r--
Error                           : File format error

The perl method is more safer adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png On Android 7 adb shell screencap -p > ~/Desktop/screen.png

sudhirkhanger commented 3 years ago

's|\r\r$||' instead of 's/\r$//'

The perl method is more safer
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png 

If you use perl method then you would probably need perl installed on the system which might not be a big deal if I am guessing correctly.

On Android 7
adb shell screencap -p > ~/Desktop/screen.png

Is Screencap Android OS dependent?