如何在目录中按顺序在图像中插入文本

how to insert text in images sequentially in a directory

我试过以下方法:

n=1
for index in image*.png; 
do convert $index -fill white  -undercolor '#00000080'  -gravity South -pointsize 44 -annotate +0+550 “image`echo $n`”;
((n++)); 
done

这会导致错误:

convert: `“image1”' @ error/convert.c/ConvertImageCommand/3272.

依此类推,直到目录中所有图片文件结束。

基本上我是想在图像中插入文本作为文件名。

“图像echo $n”周围的普通双引号已被 opening/closing 双引号 (*) 取代。此外,echo 是不必要的,请尝试 "image$n.png"

(*) 可能是编辑器的行为不是为了编辑代码,也许是用写字板编辑?