Create an animated gif image from still images on the cli using imagemagick

Written by - 0 comments

Published on - last updated on October 31st 2019 - Listed in Linux Multimedia Surveillance


My surveillance system (Zoneminder) "records" movements by capturing screenshots. Putting these screenshots together in order and running through them gives the same effect as watching a recorded video.

When a Zoneminder event is exported, you basically get a folder with these screenshots:

For archiving purposes this is OK, but not if you want to send this to someone. So I needed to find a way to create a video file or an animated image/gif from these images.

Luckily there's ImageMagick's convert command:

$ convert --help|grep delay
  -delay value         display the next image after pausing

I agree, the description "display the next image" does not immediately make you think of an animated gif, yet that's exactly what an animated image is.

I can now tell convert to create an animated image using the delay parameter:

$ convert -delay 0.2 *.jpg recording.gif

Additional parameters also allow an infinite loop (0 = infinite) and resizing of the animated image:

$ convert -delay 0.2 -loop 0 -resize 800x600 *.jpg recording.gif

The animated gif is slow

With the -delay 0.2 setting the resulting animated gif will appear "slow". This is because of the delay. Even if you set a delay of 0.0 you will see a slower movement than in the reality. To come to a speed closer to real time, you need to adjust the delay format a bit. For example -delay 33,1000 will give you faster results.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder