How to determine if a gif is animated?

I have a large number of files with the extension .gif. I would like to move all animated gifs to another directory. How to do this using linux shell?

+3
source share
1 answer

Basically, if identify returns more than one row for a GIF, it is more likely to be animated because it contains more than one image. However, you can get false positives.

Shell Usage Example:

for i in *.gif; do
  if [ `identify "$i" | wc -l` -gt 1 ] ; then
    echo move "$i"
  else
    echo dont move "$i"
  fi
done
+6
source

Source: https://habr.com/ru/post/1765642/


All Articles