Created
May 23, 2020 14:01
-
-
Save hellocatfood/3bcf112ba51db497aa14552023a3ed13 to your computer and use it in GitHub Desktop.
Create a typewriter text effect using Imagemagick 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Adapted from here https://imagemagick.org/discourse-server/viewtopic.php?p=163774#p163774 | |
# Requires Imagemagick 7 and a monospace font. Tested on Ubuntu 20.04 | |
FONT= # replace with path to monospace font | |
POINTS=18 | |
COUNT=0 | |
TEXT= # replace textfile.txt with path to plain text file | |
cat $TEXT | while read LINE | |
do magick \ | |
-font $FONT \ | |
-pointsize $POINTS \ | |
-kerning 1 \ | |
label:"$LINE" \ | |
label:"XXXXXXXXXX" \ | |
-colors 16 \ | |
-crop "%[fx:round(u.w/(v.w/10))]x1@" \ | |
-delete -10--1 \ | |
-background white \ | |
-coalesce \ | |
+repage \ | |
-set delay "%%[fx:t==0||t==(n-1)?75:10]" \ | |
\( \ | |
-clone -1,-1,-1,-1 \ | |
-distort affine "0,%[fx:(t+1)*h/n] 0,0 " \ | |
-set delay 10 \ | |
\) \ | |
-loop 0 \ | |
_tmp_"$COUNT".miff | |
COUNT=$(($COUNT+1)) | |
done | |
magick \ | |
_tmp_*.miff \ | |
\( \ | |
-clone 0--1 \ | |
+repage \ | |
-layers merge \ | |
\) \ | |
+insert \ | |
-loop 0 \ | |
typewriter.gif | |
rm _tmp_*.miff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment