How to make GIF from Android device screen

2019-08-10 04:17发布

I can capture Android device screen:

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > adb-screenshot-$(date +%Y%m%d-%H%M%S).png

How can I squash all those images into single GIF?

3条回答
淡お忘
2楼-- · 2019-08-10 04:48

You can use my fully working script here: android-screen-gif.sh. You simply run it with ./android-screen-gif.sh, let it record and hit Ctrl + C when you want to stop. The images will be pulled and a GIF assembled, very useful for demos/issue tracker/email! Requires convert to be on path, see the other posts here about ImageMagick.

Wrote screenshot to /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-1.png
Wrote screenshot to /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-2.png
Wrote screenshot to /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-3.png
Wrote screenshot to /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-4.png
Wrote screenshot to /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-5.png
Downloading images.
pull: building file list...
pull: /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-5.png -> ./Screenshot-20150707-105440-5.png
pull: /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-4.png -> ./Screenshot-20150707-105440-4.png
pull: /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-3.png -> ./Screenshot-20150707-105440-3.png
pull: /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-2.png -> ./Screenshot-20150707-105440-2.png
pull: /sdcard/Screenshot-20150707-105440/Screenshot-20150707-105440-1.png -> ./Screenshot-20150707-105440-1.png
5 files pulled. 0 files skipped.
6077 KB/s (5015743 bytes in 0.805s)
Assembled gif Screenshot-20150707-105440.gif
Cleaned up individual screenshots.
查看更多
Summer. ? 凉城
3楼-- · 2019-08-10 04:55

Ok, I found it.

First done screenshots in single folder and then converted it all to GIF like this:

convert *.png screens.gif

Installed ImageMagick as described here.

On Mac OS X, I've installed it like this: brew install ImageMagick.

查看更多
Anthone
4楼-- · 2019-08-10 05:05

You can use the convert command of ImageMagick to combine your .png files into one .gif animation :

convert -delay 10 -loop 0 *.png anim.gif
查看更多
登录 后发表回答