I'm creating a numbered image sequence using:
for i in `seq 001 300`
do convert -size 2048x1080 xc:none -font arial -fill black -pointsize 48 -annotate +100+100 $i output_$(printf %04d $i).png
done
This works well but I would like the annotation text to be 001, 002, etc. rather than 1,2,3,10,13,137.
How do I do that?
Annotate with leading zeros?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Annotate with leading zeros?
The obvious answer is: use the same trick in annotate as you use for the output filename.
snibgo's IM pages: im.snibgo.com
Re: Annotate with leading zeros?
Obviously thank you.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Annotate with leading zeros?
In many installations the "seq" command will take an argument so it will include the leading zeros in the output. On mine it's "-w". Maybe try something like this...
Code: Select all
... seq -w 1 300 ...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Annotate with leading zeros?
Good point, GeeMack. "seq" from Cygwin has "-w", automatically choosing the required number of leading zeros.
I can also...
... to get six digits, so three or more leading zeros.
I can also...
Code: Select all
seq -f %06g 1 300
snibgo's IM pages: im.snibgo.com