How do I draw FontAwesome icons onto an image with ImageMagick convert command?

Solution 1:

Use printf to pass the correct Unicode value to convert.

Use the -font option to set the path to the FontAwesome font file.

Use @- to tell the -annotate option to take the text that is piped in.

env LC_CTYPE=en_US.utf8 \
printf "\uF144"  | \
convert input.jpg \
-fill 'rgba(255, 255, 255, 1.0)' \
-font fontawesome-webfont.ttf \
-pointsize 140 \
-gravity Center \
-annotate +0+0 @- \
output.jpg

Solution 2:

On Macos (10.15), this worked for me:

printf "\uF144"  | \
convert input.jpg \
-fill 'rgba(255, 255, 255, 1.0)' \
-font fontawesome-webfont.ttf \
-pointsize 140 \
-gravity Center \
-annotate +0+0 @- \
output.jpg

Setting env LC_TYPE=en_US.utf8 then invoking printf produced: "\uF144". Running printf "\uF144" without the environment UTF encoding, printed the character.

I'm not sure why, but I'm submitting this to augment Liam's correct answer above for Macos users.

Running the above successfully rendered the fontawesome icon on top of the input.jpg in the resultant output.jpg image.