Skip to content

Instantly share code, notes, and snippets.

@hellocatfood
Last active August 29, 2015 14:02
Show Gist options
  • Save hellocatfood/0da4ae1b5dee99a6b44d to your computer and use it in GitHub Desktop.
Save hellocatfood/0da4ae1b5dee99a6b44d to your computer and use it in GitHub Desktop.
Overlay each line of a text file onto sequentially named image files
#!/bin/bash
#Developed for a very specific case. Your image files must be named 1.jpg, 2.jpg, 3.jpg etc. Place this script, the images files and the text file in the same folder. Then run ./overlaytext.sh. It'll overwrite the original files, so make a backup.
no=1
#change 40 to however many files you have
while [ $no -le 40 ]
#change textfile to whatever text file you have
do text=$(sed -n "$no{p}" textfile);
#the -size, -pointsize, -background and -fill can be changed to whatever you desire
convert $no.jpg -gravity Center null: -size 450 -pointsize 40 -background "#474a11" -fill white caption:"$text" -layers composite $no.jpg; no=$(($no + 1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment