Beveline
Beveline

Reputation: 297

add text to image with convert

I am being stuck at some image editing using bash commands. I have 414 images labelled 1file.png 2file.png ... 414file.png. To each of these I would like to add the number, which is already present in the name. The goal is to create a .gif which will show the counts of images in one corner counting up. (Creating the .gif using convert * result.gif works)

The problem is it will not add my number in the image but literally print $i. Does somebody know how to read in the loop variable?

I have tried:

for i in {0..9}; do
convert -pointsize 80 -fill black -draw 'text 1650 400 "$i"' "$i"file.png "$i"file.png;
done

Many thanks in advance.

Upvotes: 3

Views: 3540

Answers (1)

Beveline
Beveline

Reputation: 297

Problem solved:

for i in {0..1}; do
convert -pointsize 80 -fill black -draw 'text 1650 400 '\"$i\"'' "$i"file.png "$i"file.png;
done

Upvotes: 4

Related Questions