Skip to content

Instantly share code, notes, and snippets.

@felix11h
Created March 9, 2018 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felix11h/4fffc3338a70b900bc3a8d9964d44f2e to your computer and use it in GitHub Desktop.
Save felix11h/4fffc3338a70b900bc3a8d9964d44f2e to your computer and use it in GitHub Desktop.
Add annotation to GIFs with Imagemagick
#!/bin/sh
## manullay find frame in which caption should change
# mkdir frames_s01
# convert -coalesce source_01.gif frames_s01/out%05d.gif
mkdir tmp/
convert source_01.gif[0-50] tmp/tm01.gif
convert source_01.gif[51-100] tmp/tm02.gif
## documentation:
# http://www.imagemagick.org/Usage/annotating/
# http://www.imagemagick.org/Usage/anim_mods/#label
convert tmp/tm01.gif -coalesce \
-gravity South -background white -splice 0x80 \
-pointsize 32 \
-annotate +0+40 '1. Multiline annotation' \
-annotate +0+4 'appears here' \
-layers Optimize tmp/tm01_annotated.gif
convert tmp/tm02.gif -coalesce \
-gravity South -background white -splice 0x80 \
-pointsize 36 \
-annotate +0+18 '2. Single line here' \
-layers Optimize tmp/tm02_annotated.gif
convert tmp/tm01_annotated.gif tmp/tm02_annotated.gif out.gif
rm -rf tmp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment